3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public $obj; } class Zoo { public $obj; public function setObj($obj) { $this->obj = $obj; } public function show() { var_dump($this->obj); } } class Bar {} class Baz {} $foo = new Foo(); $zoo = new Zoo(); $a = new Bar(); $b = new Baz(); $zoo->obj = &$foo->obj; //$tmp = &$foo->obj; $zoo->setObj($tmp); $zoo->show(); $foo->obj = $a; $zoo->show(); $foo->obj = $b; $zoo->show();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UhtRi
function name:  (null)
number of ops:  30
compiled vars:  !0 = $foo, !1 = $zoo, !2 = $a, !3 = $b, !4 = $tmp
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $5      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $5
   16     3        NEW                                              $8      'Zoo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $8
   18     6        NEW                                              $11     'Bar'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !2, $11
   19     9        NEW                                              $14     'Baz'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !3, $14
   21    12        FETCH_OBJ_W                                      $18     !0, 'obj'
         13        MAKE_REF                                         $19     $18
         14        ASSIGN_OBJ_REF                                           !1, 'obj'
         15        OP_DATA                                                  $19
   23    16        INIT_METHOD_CALL                                         !1, 'setObj'
         17        SEND_VAR_EX                                              !4
         18        DO_FCALL                                      0          
   24    19        INIT_METHOD_CALL                                         !1, 'show'
         20        DO_FCALL                                      0          
   25    21        ASSIGN_OBJ                                               !0, 'obj'
         22        OP_DATA                                                  !2
   26    23        INIT_METHOD_CALL                                         !1, 'show'
         24        DO_FCALL                                      0          
   27    25        ASSIGN_OBJ                                               !0, 'obj'
         26        OP_DATA                                                  !3
   28    27        INIT_METHOD_CALL                                         !1, 'show'
         28        DO_FCALL                                      0          
         29      > RETURN                                                   1

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

End of function setobj

Function show:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UhtRi
function name:  show
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_OBJ_R                                      ~0      'obj'
          2        SEND_VAL                                                 ~0
          3        DO_ICALL                                                 
          4      > RETURN                                                   null

End of function show

End of class Zoo.

Class Bar: [no user functions]
Class Baz: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.84 ms | 1392 KiB | 15 Q