3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public $foo; function setFoo($foo) { $this->foo = $foo; } function getFoo() { return $this->foo; } } class B { function setObj(A $a, $value) { $a->setFoo($value); } function setObjExpl(A &$a, $value) { $a->setFoo($value); } } $a = new A(); $b = new B(); $a->setFoo(1); echo $a->getFoo(), "\n"; $b->setObj($a, 10); echo $a->getFoo(), "\n"; $b->setObj($a, 100); echo $a->getFoo(), "\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eZD6f
function name:  (null)
number of ops:  30
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   23     3        NEW                                              $5      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   25     6        INIT_METHOD_CALL                                         !0, 'setFoo'
          7        SEND_VAL_EX                                              1
          8        DO_FCALL                                      0          
   26     9        INIT_METHOD_CALL                                         !0, 'getFoo'
         10        DO_FCALL                                      0  $9      
         11        ECHO                                                     $9
         12        ECHO                                                     '%0A'
   28    13        INIT_METHOD_CALL                                         !1, 'setObj'
         14        SEND_VAR_EX                                              !0
         15        SEND_VAL_EX                                              10
         16        DO_FCALL                                      0          
   29    17        INIT_METHOD_CALL                                         !0, 'getFoo'
         18        DO_FCALL                                      0  $11     
         19        ECHO                                                     $11
         20        ECHO                                                     '%0A'
   31    21        INIT_METHOD_CALL                                         !1, 'setObj'
         22        SEND_VAR_EX                                              !0
         23        SEND_VAL_EX                                              100
         24        DO_FCALL                                      0          
   32    25        INIT_METHOD_CALL                                         !0, 'getFoo'
         26        DO_FCALL                                      0  $13     
         27        ECHO                                                     $13
         28        ECHO                                                     '%0A'
         29      > RETURN                                                   1

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

End of function setfoo

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eZD6f
function name:  getFoo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1      > RETURN                                                   ~0
    9     2*     > RETURN                                                   null

End of function getfoo

End of class A.

Class B:
Function setobj:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eZD6f
function name:  setObj
number of ops:  6
compiled vars:  !0 = $a, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2        INIT_METHOD_CALL                                         !0, 'setFoo'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
   15     5      > RETURN                                                   null

End of function setobj

Function setobjexpl:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eZD6f
function name:  setObjExpl
number of ops:  6
compiled vars:  !0 = $a, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   18     2        INIT_METHOD_CALL                                         !0, 'setFoo'
          3        SEND_VAR_EX                                              !1
          4        DO_FCALL                                      0          
   19     5      > RETURN                                                   null

End of function setobjexpl

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
172.55 ms | 1399 KiB | 13 Q