3v4l.org

run code in 300+ PHP versions simultaneously
<?php Class Bar { public static $name = "bar"; } Class Foo { public function getParent(){ $this->parentClass = new Bar(); return $this; } } $foo = (new Foo())->getParent(); echo get_class_vars(get_class($foo->parentClass))["name"];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qJZTg
function name:  (null)
number of ops:  13
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $1, 'getParent'
          3        DO_FCALL                                      0  $3      
          4        ASSIGN                                                   !0, $3
   15     5        INIT_FCALL                                               'get_class_vars'
          6        FETCH_OBJ_R                                      ~5      !0, 'parentClass'
          7        GET_CLASS                                        ~6      ~5
          8        SEND_VAL                                                 ~6
          9        DO_ICALL                                         $7      
         10        FETCH_DIM_R                                      ~8      $7, 'name'
         11        ECHO                                                     ~8
         12      > RETURN                                                   1

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

End of function getparent

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.24 ms | 1004 KiB | 14 Q