3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A{ public function __construct(){ $b = new B(); $a = $this; $b->a = function() use($a){ $a->x(); }; $b->callA(); } public function x(){ var_dump('a'); } } class B { public $a; public function callA(){ $this->$a(); } } $a = new A();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zja8Q
function name:  (null)
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
          3      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FZja8Q%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zja8Q
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   BIND_STATIC                                              !0
    7     1        INIT_METHOD_CALL                                         !0, 'x'
          2        DO_FCALL                                      0          
    8     3      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FZja8Q%3A6%240

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zja8Q
function name:  __construct
number of ops:  12
compiled vars:  !0 = $b, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   NEW                                              $2      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    5     3        FETCH_THIS                                       ~5      
          4        ASSIGN                                                   !1, ~5
    6     5        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FZja8Q%3A6%240'
          6        BIND_LEXICAL                                             ~8, !1
          7        ASSIGN_OBJ                                               !0, 'a'
    8     8        OP_DATA                                                  ~8
    9     9        INIT_METHOD_CALL                                         !0, 'callA'
         10        DO_FCALL                                      0          
   10    11      > RETURN                                                   null

End of function __construct

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

End of function x

End of class A.

Class B:
Function calla:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Zja8Q
function name:  callA
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   INIT_METHOD_CALL                                         !0
          1        DO_FCALL                                      0          
   19     2      > RETURN                                                   null

End of function calla

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.08 ms | 1400 KiB | 15 Q