3v4l.org

run code in 300+ PHP versions simultaneously
<?php function enum() { for($enums = func_get_args(), $enum = reset($enums), $i = 1; $enum; $enum = next($enums), ++$i) { eval('const ' . $enum . ' = ' . $i . ';'); } } // enum() enum('CONST0', 'CONST1', 'CONST2'); $t = CONST1; if($t == CONST0) print_r(CONST0); else print_r($t);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eT8cr
function name:  (null)
number of ops:  19
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'enum'
          1        SEND_VAL                                                 'CONST0'
          2        SEND_VAL                                                 'CONST1'
          3        SEND_VAL                                                 'CONST2'
          4        DO_FCALL                                      0          
   13     5        FETCH_CONSTANT                                   ~2      'CONST1'
          6        ASSIGN                                                   !0, ~2
   15     7        FETCH_CONSTANT                                   ~4      'CONST0'
          8        IS_EQUAL                                                 !0, ~4
          9      > JMPZ                                                     ~5, ->15
   16    10    >   INIT_FCALL                                               'print_r'
         11        FETCH_CONSTANT                                   ~6      'CONST0'
         12        SEND_VAL                                                 ~6
         13        DO_ICALL                                                 
         14      > JMP                                                      ->18
   18    15    >   INIT_FCALL                                               'print_r'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18    > > RETURN                                                   1

Function enum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 8
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 19, Position 2 = 8
Branch analysis from position: 19
Branch analysis from position: 8
filename:       /in/eT8cr
function name:  enum
number of ops:  20
compiled vars:  !0 = $enums, !1 = $enum, !2 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   FUNC_GET_ARGS                                    ~3      
          1        ASSIGN                                                   !0, ~3
          2        INIT_FCALL                                               'reset'
          3        SEND_REF                                                 !0
          4        DO_ICALL                                         $5      
          5        ASSIGN                                                   !1, $5
          6        ASSIGN                                                   !2, 1
          7      > JMP                                                      ->18
    6     8    >   CONCAT                                           ~8      'const+', !1
          9        CONCAT                                           ~9      ~8, '+%3D+'
         10        CONCAT                                           ~10     ~9, !2
         11        CONCAT                                           ~11     ~10, '%3B'
         12        INCLUDE_OR_EVAL                                          ~11, EVAL
    4    13        INIT_FCALL                                               'next'
         14        SEND_REF                                                 !0
         15        DO_ICALL                                         $13     
         16        ASSIGN                                                   !1, $13
         17        PRE_INC                                                  !2
         18    > > JMPNZ                                                    !1, ->8
    9    19    > > RETURN                                                   null

End of function enum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.16 ms | 1403 KiB | 20 Q