3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '<?php public function enum($value, ...$items) {}'; $tokens = token_get_all($string); foreach ($tokens as $token) { if (is_array($token) === true) { $name = token_name($token[0]); echo "TOKEN $name FOUND: ".$token[1]."\n"; } }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 23
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 23
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 22
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 22
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/Bev9Y
function name:  (null)
number of ops:  25
compiled vars:  !0 = $string, !1 = $tokens, !2 = $token, !3 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, '%3C%3Fphp+public+function+enum%28%24value%2C+...%24items%29+%7B%7D'
    3     1        INIT_FCALL                                               'token_get_all'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $5      
          4        ASSIGN                                                   !1, $5
    4     5      > FE_RESET_R                                       $7      !1, ->23
          6    > > FE_FETCH_R                                               $7, !2, ->23
    5     7    >   TYPE_CHECK                                  128  ~8      !2
          8        TYPE_CHECK                                    8          ~8
          9      > JMPZ                                                     ~9, ->22
    6    10    >   INIT_FCALL                                               'token_name'
         11        FETCH_DIM_R                                      ~10     !2, 0
         12        SEND_VAL                                                 ~10
         13        DO_ICALL                                         $11     
         14        ASSIGN                                                   !3, $11
    7    15        ROPE_INIT                                     3  ~14     'TOKEN+'
         16        ROPE_ADD                                      1  ~14     ~14, !3
         17        ROPE_END                                      2  ~13     ~14, '+FOUND%3A+'
         18        FETCH_DIM_R                                      ~16     !2, 1
         19        CONCAT                                           ~17     ~13, ~16
         20        CONCAT                                           ~18     ~17, '%0A'
         21        ECHO                                                     ~18
    4    22    > > JMP                                                      ->6
         23    >   FE_FREE                                                  $7
    9    24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.17 ms | 1387 KiB | 17 Q