3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo(B &$class) { $class = new B; $class->bar = 5; } } class B { public $bar = null; } $A = new A; $B = new B; $A->foo($B); var_dump($A, $B);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ooRMb
function name:  (null)
number of ops:  14
compiled vars:  !0 = $A, !1 = $B
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        NEW                                              $5      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   17     6        INIT_METHOD_CALL                                         !0, 'foo'
          7        SEND_VAR_EX                                              !1
          8        DO_FCALL                                      0          
   19     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        SEND_VAR                                                 !1
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

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

End of function foo

End of class A.

Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.81 ms | 1395 KiB | 15 Q