3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyObject { public $var; } class MyObjectTwo { public $objVar; function __construct($aObj1) { $this->objVar = $aObj1; } public function someFunction() { $this->objVar->var++; } } $obj1 = new MyObject(); $obj1->var = 5; // Originally set to 5 $obj2 = new MyObjectTwo($obj1); $obj2->someFunction(); //echo $obj1->var; // Prints 6
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pNTHd
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj1, !1 = $obj2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   NEW                                              $2      'MyObject'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   18     3        ASSIGN_OBJ                                               !0, 'var'
          4        OP_DATA                                                  5
   20     5        NEW                                              $6      'MyObjectTwo'
          6        SEND_VAR_EX                                              !0
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $6
   21     9        INIT_METHOD_CALL                                         !1, 'someFunction'
         10        DO_FCALL                                      0          
   22    11      > RETURN                                                   1

Class MyObject: [no user functions]
Class MyObjectTwo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pNTHd
function name:  __construct
number of ops:  4
compiled vars:  !0 = $aObj1
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ASSIGN_OBJ                                               'objVar'
          2        OP_DATA                                                  !0
   10     3      > RETURN                                                   null

End of function __construct

Function somefunction:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/pNTHd
function name:  someFunction
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   FETCH_OBJ_RW                                     $0      'objVar'
          1        PRE_INC_OBJ                                              $0, 'var'
   14     2      > RETURN                                                   null

End of function somefunction

End of class MyObjectTwo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.59 ms | 939 KiB | 14 Q