3v4l.org

run code in 500+ PHP versions simultaneously
<?php class test1 { const a = 'b', b = 'a', c = 'c'; public function __construct() { echo self::b, self::a, self::c, PHP_EOL; } } class test2 { private $a = 'b', $b = 'a', $c = 'c'; } try { new test1; // abc echo test2::$b, test2::$a, test2::$c; // Cannot access private property test2::$b } catch (Error $e) { echo $e->getMessage(); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qRnlk
function name:  (null)
number of ops:  15
compiled vars:  !0 = $e
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   NEW                                                  $1      'test1'
          1        DO_FCALL                                          0          
          2        FREE                                                         $1
   20     3        FETCH_STATIC_PROP_R              global lock         ~3      'b'
          4        ECHO                                                         ~3
          5        FETCH_STATIC_PROP_R              unknown             ~4      'a'
          6        ECHO                                                         ~4
          7        FETCH_STATIC_PROP_R              unknown             ~5      'c'
          8        ECHO                                                         ~5
          9      > JMP                                                          ->14
   21    10  E > > CATCH                                           last         'Error'
   22    11    >   INIT_METHOD_CALL                                             !0, 'getMessage'
         12        DO_FCALL                                          0  $6      
         13        ECHO                                                         $6
   23    14    > > RETURN                                                       1

Class test1:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qRnlk
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    9     0  E >   ECHO                                                         'a'
          1        ECHO                                                         'b'
          2        ECHO                                                         'c'
          3        ECHO                                                         '%0A'
   10     4      > RETURN                                                       null

End of function __construct

End of class test1.

Class test2: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
171.26 ms | 2956 KiB | 13 Q