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; $a = $b->obj; echo $a::foo; // Parse error!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/cqo8A
function name:  (null)
number of ops:  9
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $2      'b'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        FETCH_OBJ_R                                      ~5      !0, 'obj'
          4        ASSIGN                                                   !1, ~5
   19     5        FETCH_CLASS                                   0  $7      !1
          6        FETCH_CLASS_CONSTANT                             ~8      $7, 'foo'
          7        ECHO                                                     ~8
          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/cqo8A
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $1      'a'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'obj'
          3        OP_DATA                                                  $1
   14     4      > RETURN                                                   null

End of function __construct

End of class b.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.13 ms | 1393 KiB | 13 Q