3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private const C1 = "a"; private const C2 = 'b'; } try { var_dump(constant('Foo::C1')); } catch(Error $e) { echo 'Caught',$e->getMessage(), PHP_EOL; } try{ Foo::C2; } catch(Error $e) { echo 'Caught',$e->getMessage() ,PHP_EOL; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 7
Branch analysis from position: 7
2 jumps found. (Code = 107) Position 1 = 8, Position 2 = -2
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
Found catch point at position: 16
Branch analysis from position: 16
2 jumps found. (Code = 107) Position 1 = 17, Position 2 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JY1AO
function name:  (null)
number of ops:  23
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'constant'
          2        SEND_VAL                                                 'Foo%3A%3AC1'
          3        DO_ICALL                                         $1      
          4        SEND_VAR                                                 $1
          5        DO_ICALL                                                 
          6      > JMP                                                      ->13
   10     7  E > > CATCH                                       last         'Error'
   11     8    >   ECHO                                                     'Caught'
          9        INIT_METHOD_CALL                                         !0, 'getMessage'
         10        DO_FCALL                                      0  $3      
         11        ECHO                                                     $3
         12        ECHO                                                     '%0A'
   15    13    >   FETCH_CLASS_CONSTANT                             ~4      'Foo', 'C2'
         14        FREE                                                     ~4
         15      > JMP                                                      ->22
   17    16  E > > CATCH                                       last         'Error'
   18    17    >   ECHO                                                     'Caught'
         18        INIT_METHOD_CALL                                         !0, 'getMessage'
         19        DO_FCALL                                      0  $5      
         20        ECHO                                                     $5
         21        ECHO                                                     '%0A'
   19    22    > > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
180.46 ms | 1395 KiB | 17 Q