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    >   ASSIGN_OBJ                                               'Caught'
         9        INIT_METHOD_CALL                                         !0, 'getMessage'
        10        DO_FCALL                                      0  $3      
        11        ASSIGN_OBJ                                               $3
        12        ASSIGN_OBJ                                               '%0A'
  15    13    >   FETCH_CLASS_CONSTANT                             ~4      'Foo', 'C2'
        14        FREE                                                     ~4
        15      > JMP                                                      ->22
  17    16  E > > CATCH                                       last         'Error'
  18    17    >   ASSIGN_OBJ                                               'Caught'
        18        INIT_METHOD_CALL                                         !0, 'getMessage'
        19        DO_FCALL                                      0  $5      
        20        ASSIGN_OBJ                                               $5
        21        ASSIGN_OBJ                                               '%0A'
  19    22    > > RETURN                                                   1

Class Foo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
14.38 ms | 411 KiB | 7 Q