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(); } private function x(){ var_dump('a'); } } class B { public $a; public function callA(){ $this->a[0](); } } $a = new A();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6VQrD
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%2F6VQrD%3A6%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6VQrD
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%2F6VQrD%3A6%240

Class A:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6VQrD
function name:  __construct
number of ops:  13
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%2F6VQrD%3A6%240'
          6        BIND_LEXICAL                                             ~9, !1
          7        FETCH_OBJ_W                                      $7      !0, 'a'
          8        ASSIGN_DIM                                               $7
    8     9        OP_DATA                                                  ~9
    9    10        INIT_METHOD_CALL                                         !0, 'callA'
         11        DO_FCALL                                      0          
   10    12      > 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/6VQrD
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/6VQrD
function name:  callA
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   FETCH_OBJ_R                                      ~0      'a'
          1        FETCH_DIM_R                                      ~1      ~0, 0
          2        INIT_DYNAMIC_CALL                                        ~1
          3        DO_FCALL                                      0          
   19     4      > RETURN                                                   null

End of function calla

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.86 ms | 1400 KiB | 15 Q