3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<?php function MyFunction1() { // Some code goes here. } function MyFunction2() { // Some code goes here. } class MyClass { function MyFunction3() { // Some code goes here. } function MyFunction4() { // Some code goes here. } public function register(); } public function register(); function foo() { } function foo() {} function foo() { } function foo() { for ($i = 0; $i < $bar; $i++) { }//end for } '; $tokens = token_get_all($string); foreach ($tokens as $i => $token) { echo "$i : "; if (is_array($token) === false) { echo $token; } else { echo token_name($token[0]).' => '.str_replace(PHP_EOL, '\n', $token[1]); } echo PHP_EOL; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 31
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 31
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 29
Branch analysis from position: 29
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/uRLib
function name:  (null)
number of ops:  33
compiled vars:  !0 = $string, !1 = $tokens, !2 = $token, !3 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, '%3C%3Fphp%0A%0Afunction+MyFunction1%28%29+%7B%0A++++%2F%2F+Some+code+goes+here.%0A%0A%7D%0A%0Afunction+MyFunction2%28%29+%7B%0A++++%2F%2F+Some+code+goes+here.%0A%7D%0A%0Aclass+MyClass%0A%7B%0A++++function+MyFunction3%28%29+%7B%0A++++++++%2F%2F+Some+code+goes+here.%0A%0A++++%7D%0A%0A++++function+MyFunction4%28%29+%7B%0A++++++++%2F%2F+Some+code+goes+here.%0A++++%7D%0A%0A++++public+function+register%28%29%3B%0A%7D%0A%0Apublic+function+register%28%29%3B%0A%0Afunction+foo%28%29+%7B+%7D%0Afunction+foo%28%29+%7B%7D%0Afunction+foo%28%29+%7B%0A%7D%0A%0Afunction+foo%28%29%0A%7B%0A++++for+%28%24i+%3D+0%3B+%24i+%3C+%24bar%3B+%24i%2B%2B%29+%7B%0A++++%7D%2F%2Fend+for%0A%0A%0A%7D%0A'
   44     1        INIT_FCALL                                               'token_get_all'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
   45     5      > FE_RESET_R                                       $7      !1, ->31
          6    > > FE_FETCH_R                                       ~8      $7, !2, ->31
          7    >   ASSIGN                                                   !3, ~8
   46     8        NOP                                                      
          9        FAST_CONCAT                                      ~10     !3, '+%3A+'
         10        ECHO                                                     ~10
   47    11        TYPE_CHECK                                  128  ~11     !2
         12        TYPE_CHECK                                    4          ~11
         13      > JMPZ                                                     ~12, ->16
   48    14    >   ECHO                                                     !2
         15      > JMP                                                      ->29
   50    16    >   INIT_FCALL                                               'token_name'
         17        FETCH_DIM_R                                      ~13     !2, 0
         18        SEND_VAL                                                 ~13
         19        DO_ICALL                                         $14     
         20        CONCAT                                           ~15     $14, '+%3D%3E+'
         21        INIT_FCALL                                               'str_replace'
         22        SEND_VAL                                                 '%0A'
         23        SEND_VAL                                                 '%5Cn'
         24        FETCH_DIM_R                                      ~16     !2, 1
         25        SEND_VAL                                                 ~16
         26        DO_ICALL                                         $17     
         27        CONCAT                                           ~18     ~15, $17
         28        ECHO                                                     ~18
   53    29    >   ECHO                                                     '%0A'
   45    30      > JMP                                                      ->6
         31    >   FE_FREE                                                  $7
   54    32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
282.67 ms | 1400 KiB | 20 Q