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'); print_r(CONST0);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/EC0gF
function name:  (null)
number of ops:  10
compiled vars:  none
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        INIT_FCALL                                               'print_r'
          6        FETCH_CONSTANT                                   ~1      'CONST0'
          7        SEND_VAL                                                 ~1
          8        DO_ICALL                                                 
          9      > 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/EC0gF
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:
157.74 ms | 1390 KiB | 20 Q