3v4l.org

run code in 300+ PHP versions simultaneously
<?php var_dump(array_map(function($token) { if (is_array($token)) $token[0] = token_name($token[0]); return $token; }, token_get_all("<?php if (0 === 1) {} elseif (1 === 2) {} else {}"))); var_dump(array_map(function($token) { if (is_array($token)) $token[0] = token_name($token[0]); return $token; }, token_get_all("<?php if (0 === 1) {} else if (1 === 2) {} else {}")));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Kh9j1
function name:  (null)
number of ops:  23
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'array_map'
          2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKh9j1%3A3%240'
    7     3        SEND_VAL                                                 ~0
          4        INIT_FCALL                                               'token_get_all'
          5        SEND_VAL                                                 '%3C%3Fphp+if+%280+%3D%3D%3D+1%29+%7B%7D+elseif+%281+%3D%3D%3D+2%29+%7B%7D+else+%7B%7D'
          6        DO_ICALL                                         $1      
          7        SEND_VAR                                                 $1
          8        DO_ICALL                                         $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                                 
    9    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'array_map'
         13        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FKh9j1%3A9%241'
   13    14        SEND_VAL                                                 ~4
         15        INIT_FCALL                                               'token_get_all'
         16        SEND_VAL                                                 '%3C%3Fphp+if+%280+%3D%3D%3D+1%29+%7B%7D+else+if+%281+%3D%3D%3D+2%29+%7B%7D+else+%7B%7D'
         17        DO_ICALL                                         $5      
         18        SEND_VAR                                                 $5
         19        DO_ICALL                                         $6      
         20        SEND_VAR                                                 $6
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FKh9j1%3A3%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/Kh9j1
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->9
          3    >   INIT_FCALL                                               'token_name'
          4        FETCH_DIM_R                                      ~3      !0, 0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
          7        ASSIGN_DIM                                               !0, 0
          8        OP_DATA                                                  $4
    6     9    > > RETURN                                                   !0
    7    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKh9j1%3A3%240

Function %00%7Bclosure%7D%2Fin%2FKh9j1%3A9%241:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 9
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
filename:       /in/Kh9j1
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $token
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        TYPE_CHECK                                  128          !0
          2      > JMPZ                                                     ~1, ->9
          3    >   INIT_FCALL                                               'token_name'
          4        FETCH_DIM_R                                      ~3      !0, 0
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                         $4      
          7        ASSIGN_DIM                                               !0, 0
          8        OP_DATA                                                  $4
   12     9    > > RETURN                                                   !0
   13    10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FKh9j1%3A9%241

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.76 ms | 1400 KiB | 21 Q