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) { if(defined($enum)) throw new Exception($enum.' is already defined.'); else define($enum, $i); } } // enum() enum('CONST0', 'CONST1', 'CONST2');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OnjvU
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                               'enum'
          1        SEND_VAL                                                 'CONST0'
          2        SEND_VAL                                                 'CONST1'
          3        SEND_VAL                                                 'CONST2'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Function enum:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 18
Branch analysis from position: 12
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 18
2 jumps found. (Code = 44) Position 1 = 28, Position 2 = 8
Branch analysis from position: 28
Branch analysis from position: 8
filename:       /in/OnjvU
function name:  enum
number of ops:  29
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                                                      ->27
    6     8    >   INIT_FCALL                                               'defined'
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $8      
         11      > JMPZ                                                     $8, ->18
         12    >   NEW                                              $9      'Exception'
         13        CONCAT                                           ~10     !1, '+is+already+defined.'
         14        SEND_VAL_EX                                              ~10
         15        DO_FCALL                                      0          
         16      > THROW                                         0          $9
         17*       JMP                                                      ->22
    7    18    >   INIT_FCALL                                               'define'
         19        SEND_VAR                                                 !1
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                                 
    4    22        INIT_FCALL                                               'next'
         23        SEND_REF                                                 !0
         24        DO_ICALL                                         $13     
         25        ASSIGN                                                   !1, $13
         26        PRE_INC                                                  !2
         27    > > JMPNZ                                                    !1, ->8
   10    28    > > RETURN                                                   null

End of function enum

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.07 ms | 1403 KiB | 22 Q