3v4l.org

run code in 300+ PHP versions simultaneously
<?php class a{ const foo = "test"; } class b{ public $obj = null; public function __construct(){ $this->obj = new a; } } $b = new b; echo $b->{obj}::foo; // Parse error!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cAHYX
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'b'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   16     3        FETCH_CONSTANT                                   ~4      'obj'
          4        FETCH_OBJ_R                                      ~5      !0, ~4
          5        FETCH_CLASS                                   0  $6      ~5
          6        FETCH_CLASS_CONSTANT                             ~7      $6, 'foo'
          7        ECHO                                                     ~7
          8      > RETURN                                                   1

Class a: [no user functions]
Class b:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cAHYX
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'obj'
          3        OP_DATA                                                  $1
   11     4      > RETURN                                                   null

End of function __construct

End of class b.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.37 ms | 1393 KiB | 13 Q