3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { private $bar; public function __construct() { $this->bar = new bar(); } public function & __get($key) { $bar = $this->bar; return $bar; } } class bar { public $onBaz = []; } $foo = new foo(); $foo->bar->onBaz[] = function() {}; var_dump($foo->bar->onBaz);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBpN8
function name:  (null)
number of ops:  14
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   18     3        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FGBpN8%3A18%240'
          4        FETCH_OBJ_W                                      $4      !0, 'bar'
          5        FETCH_OBJ_W                                      $5      $4, 'onBaz'
          6        ASSIGN_DIM                                               $5
          7        OP_DATA                                                  ~7
   19     8        INIT_FCALL                                               'var_dump'
          9        FETCH_OBJ_R                                      ~8      !0, 'bar'
         10        FETCH_OBJ_R                                      ~9      ~8, 'onBaz'
         11        SEND_VAL                                                 ~9
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FGBpN8%3A18%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBpN8
function name:  {closure}
number of ops:  1
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E > > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FGBpN8%3A18%240

Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GBpN8
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $1      'bar'
          1        DO_FCALL                                      0          
          2        ASSIGN_OBJ                                               'bar'
          3        OP_DATA                                                  $1
    8     4      > RETURN                                                   null

End of function __construct

Function __get:
Finding entry points
Branch analysis from position: 0
Return found
filename:       /in/GBpN8
function name:  __get
number of ops:  5
compiled vars:  !0 = $key, !1 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   11     1        FETCH_OBJ_R                                      ~2      'bar'
          2        ASSIGN                                                   !1, ~2
   12     3      > RETURN_BY_REF                                            !1
   13     4*     > RETURN_BY_REF                                            null

End of function __get

End of class foo.

Class bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.39 ms | 1396 KiB | 15 Q