3v4l.org

run code in 500+ PHP versions simultaneously
<?php trait Foo { public function run() { $f = function () { $this->execute(); }; $f(); } } class A { use Foo; private function execute() { echo "test"; } } $a = new A(); $a->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UC2ac
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   15     0  E >   DECLARE_CLASS                                                'a'
   25     1        NEW                                                  $1      'A'
          2        DO_FCALL                                          0          
          3        ASSIGN                                                       !0, $1
   26     4        INIT_METHOD_CALL                                             !0, 'run'
          5        DO_FCALL                                          0          
          6      > RETURN                                                       1

Class Foo:
Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UC2ac
function name:  run
number of ops:  5
compiled vars:  !0 = $f
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                              ~1      [0]
          1        ASSIGN                                                       !0, ~1
   11     2        INIT_DYNAMIC_CALL                                            !0
          3        DO_FCALL                                          0          
   12     4      > 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/UC2ac
function name:  {closure:Foo::run():7}
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    8     0  E >   INIT_METHOD_CALL                                             'execute'
          1        DO_FCALL                                          0          
    9     2      > RETURN                                                       null

End of Dynamic Function 0

End of function run

End of class Foo.

Class A:
Function execute:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UC2ac
function name:  execute
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   ECHO                                                         'test'
   22     1      > RETURN                                                       null

End of function execute

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
154.59 ms | 1704 KiB | 13 Q