3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function foo() { var_dump($this); } } class B extends A { public function getClosure() { return function () { A::foo(); }; } } $b = new B(); $b->getClosure()();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uDi8W
function name:  (null)
number of ops:  8
compiled vars:  !0 = $b
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   17     0  E >   NEW                                                  $1      'B'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   18     3        INIT_METHOD_CALL                                             !0, 'getClosure'
          4        DO_FCALL                                          0  $4      
          5        INIT_DYNAMIC_CALL                                            $4
          6        DO_FCALL                                          0          
          7      > RETURN                                                       1

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

End of function foo

End of class A.

Class B:
Function getclosure:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uDi8W
function name:  getClosure
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   DECLARE_LAMBDA_FUNCTION                              ~0      [0]
   13     1      > RETURN                                                       ~0
   14     2*     > RETURN                                                       null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uDi8W
function name:  {closure:B::getClosure():11}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_STATIC_METHOD_CALL                                      'A', 'foo'
          1        DO_FCALL                                          0          
   13     2      > RETURN                                                       null

End of Dynamic Function 0

End of function getclosure

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

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.81 ms | 1150 KiB | 14 Q