3v4l.org

run code in 300+ PHP versions simultaneously
<?php //var_dump(get_defined_constants(true)['Core']); class Foo { const ERR_SOME_CONST = 6001; const ERR_SOME_OTHER_CONST = 5001; function bar() { $x = 6001; $fooClass = new ReflectionClass ( 'Foo' ); $constants = $fooClass->getConstants(); $constants = get_defined_constants(true)['user']; var_dump($constants); $constName = null; foreach ( $constants as $name => $value ) { if ( $value == $x ) { $constName = $name; break; } } echo $constName; } } echo (new Foo)->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HCtCV
function name:  (null)
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $0      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'bar'
          3        DO_FCALL                                      0  $2      
          4        ECHO                                                     $2
          5      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 18, Position 2 = 25
Branch analysis from position: 18
2 jumps found. (Code = 78) Position 1 = 19, Position 2 = 25
Branch analysis from position: 19
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 24
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 25
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
Branch analysis from position: 25
Branch analysis from position: 25
filename:       /in/HCtCV
function name:  bar
number of ops:  28
compiled vars:  !0 = $x, !1 = $fooClass, !2 = $constants, !3 = $constName, !4 = $value, !5 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ASSIGN                                                   !0, 6001
   11     1        NEW                                              $7      'ReflectionClass'
          2        SEND_VAL_EX                                              'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                                   !1, $7
   12     5        INIT_METHOD_CALL                                         !1, 'getConstants'
          6        DO_FCALL                                      0  $10     
          7        ASSIGN                                                   !2, $10
   14     8        INIT_FCALL                                               'get_defined_constants'
          9        SEND_VAL                                                 <true>
         10        DO_ICALL                                         $12     
         11        FETCH_DIM_R                                      ~13     $12, 'user'
         12        ASSIGN                                                   !2, ~13
   16    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
   18    16        ASSIGN                                                   !3, null
   19    17      > FE_RESET_R                                       $17     !2, ->25
         18    > > FE_FETCH_R                                       ~18     $17, !4, ->25
         19    >   ASSIGN                                                   !5, ~18
   21    20        IS_EQUAL                                                 !4, !0
         21      > JMPZ                                                     ~20, ->24
   23    22    >   ASSIGN                                                   !3, !5
   24    23      > JMP                                                      ->25
   19    24    > > JMP                                                      ->18
         25    >   FE_FREE                                                  $17
   28    26        ECHO                                                     !3
   29    27      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.6 ms | 1400 KiB | 17 Q