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(); $constName = null; foreach ( $constants as $name => $value ) { if ( $value == $x ) { $constName = $name; break; } } echo $constName; } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XMqbg
function name:  (null)
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E > > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 17
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 14, Position 2 = 16
Branch analysis from position: 14
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 17
Branch analysis from position: 17
filename:       /in/XMqbg
function name:  bar
number of ops:  20
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        ASSIGN                                                   !3, null
   15     9      > FE_RESET_R                                       $13     !2, ->17
         10    > > FE_FETCH_R                                       ~14     $13, !4, ->17
         11    >   ASSIGN                                                   !5, ~14
   17    12        IS_EQUAL                                                 !4, !0
         13      > JMPZ                                                     ~16, ->16
   19    14    >   ASSIGN                                                   !3, !5
   20    15      > JMP                                                      ->17
   15    16    > > JMP                                                      ->10
         17    >   FE_FREE                                                  $13
   24    18        ECHO                                                     !3
   25    19      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.38 ms | 1395 KiB | 13 Q