3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { protected $a; public function setA($a) { $this->a = $a; } } class B { public function changeA(A $obj) { $obj->setA('bar'); } } $obj = new A(); $obj->setA('foo'); var_dump($obj); $c = new B(); $c->changeA($obj); var_dump($obj);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Piek
function name:  (null)
number of ops:  19
compiled vars:  !0 = $obj, !1 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   15     3        INIT_METHOD_CALL                                         !0, 'setA'
          4        SEND_VAL_EX                                              'foo'
          5        DO_FCALL                                      0          
   17     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
   19     9        NEW                                              $7      'B'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $7
   20    12        INIT_METHOD_CALL                                         !1, 'changeA'
         13        SEND_VAR_EX                                              !0
         14        DO_FCALL                                      0          
   22    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Class A:
Function seta:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Piek
function name:  setA
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        ASSIGN_OBJ                                               'a'
          2        OP_DATA                                                  !0
          3      > RETURN                                                   null

End of function seta

End of class A.

Class B:
Function changea:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2Piek
function name:  changeA
number of ops:  5
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        INIT_METHOD_CALL                                         !0, 'setA'
          2        SEND_VAL_EX                                              'bar'
          3        DO_FCALL                                      0          
   11     4      > RETURN                                                   null

End of function changea

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
146.55 ms | 1396 KiB | 15 Q