3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass { public $prop = "test"; public function test() { $class = new class($this){ private $parentObj; public function __construct($parentObj) { $this->parentObj = $parentObj; } public function run() { echo $this->parentObj->prop; } }; $class->run(); } } $x = new MyClass(); $x->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IRhXd
function name:  (null)
number of ops:  6
compiled vars:  !0 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class class@anonymous:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IRhXd
function name:  __construct
number of ops:  4
compiled vars:  !0 = $parentObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
   13     1        ASSIGN_OBJ                                               'parentObj'
          2        OP_DATA                                                  !0
   14     3      > RETURN                                                   null

End of function __construct

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IRhXd
function name:  run
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   FETCH_OBJ_R                                      ~0      'parentObj'
          1        FETCH_OBJ_R                                      ~1      ~0, 'prop'
          2        ECHO                                                     ~1
   18     3      > RETURN                                                   null

End of function run

End of class class@anonymous.

Class MyClass:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/IRhXd
function name:  test
number of ops:  9
compiled vars:  !0 = $class
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   DECLARE_ANON_CLASS                               <unknown> 
          1        NEW                                              $2      $1
          2        FETCH_THIS                                       $3      
          3        SEND_VAR_EX                                              $3
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   20     6        INIT_METHOD_CALL                                         !0, 'run'
          7        DO_FCALL                                      0          
   21     8      > RETURN                                                   null

End of function test

End of class MyClass.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.22 ms | 1395 KiB | 13 Q