3v4l.org

run code in 300+ PHP versions simultaneously
<?php class bar { public function doStuff(stdClass $obj) { $obj->foo = 'test'; $obj = null; } } class foo { public $obj; public function __construct() { $bar = new bar(); $this->obj = new stdClass(); $bar->doStuff($this->obj); } } $foo = new foo(); var_dump($foo->obj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJe4A
function name:  (null)
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_FCALL                                               'var_dump'
          4        FETCH_OBJ_R                                      ~4      !0, 'obj'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

Class bar:
Function dostuff:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJe4A
function name:  doStuff
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        ASSIGN_OBJ                                               !0, 'foo'
          2        OP_DATA                                                  'test'
    6     3        ASSIGN                                                   !0, null
    7     4      > RETURN                                                   null

End of function dostuff

End of class bar.

Class foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jJe4A
function name:  __construct
number of ops:  13
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $1      'bar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   15     3        NEW                                              $5      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN_OBJ                                               'obj'
          6        OP_DATA                                                  $5
   16     7        INIT_METHOD_CALL                                         !0, 'doStuff'
          8        CHECK_FUNC_ARG                                           
          9        FETCH_OBJ_FUNC_ARG                               $7      'obj'
         10        SEND_FUNC_ARG                                            $7
         11        DO_FCALL                                      0          
   17    12      > RETURN                                                   null

End of function __construct

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.39 ms | 1396 KiB | 15 Q