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(); 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/Vo7p2
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 = 16, Position 2 = 23
Branch analysis from position: 16
2 jumps found. (Code = 78) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 22
Branch analysis from position: 20
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
Branch analysis from position: 23
Branch analysis from position: 23
filename:       /in/Vo7p2
function name:  bar
number of ops:  26
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        DO_ICALL                                         $12     
         10        ASSIGN                                                   !2, $12
   16    11        INIT_FCALL                                               'var_dump'
         12        SEND_VAR                                                 !2
         13        DO_ICALL                                                 
   18    14        ASSIGN                                                   !3, null
   19    15      > FE_RESET_R                                       $16     !2, ->23
         16    > > FE_FETCH_R                                       ~17     $16, !4, ->23
         17    >   ASSIGN                                                   !5, ~17
   21    18        IS_EQUAL                                                 !4, !0
         19      > JMPZ                                                     ~19, ->22
   23    20    >   ASSIGN                                                   !3, !5
   24    21      > JMP                                                      ->23
   19    22    > > JMP                                                      ->16
         23    >   FE_FREE                                                  $16
   28    24        ECHO                                                     !3
   29    25      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.35 ms | 1396 KiB | 17 Q