3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { $a = function() { echo 'a'; }; $a(); } public function __invoke() { echo 'wtf'; } } fb_intercept( 'Foo::__invoke', function () { echo '__invoke called!'; } ); var_dump((new Foo)->bar());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/reFPi
function name:  (null)
number of ops:  13
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL_BY_NAME                                       'fb_intercept'
   16     1        SEND_VAL_EX                                              'Foo%3A%3A__invoke'
   17     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FreFPi%3A17%241'
   19     3        SEND_VAL_EX                                              ~0
          4        DO_FCALL                                      0          
   21     5        INIT_FCALL                                               'var_dump'
          6        NEW                                              $2      'Foo'
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $2, 'bar'
          9        DO_FCALL                                      0  $4      
         10        SEND_VAR                                                 $4
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FreFPi%3A5%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/reFPi
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ECHO                                                     'a'
    7     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FreFPi%3A5%240

Function %00%7Bclosure%7D%2Fin%2FreFPi%3A17%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/reFPi
function name:  {closure}
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   ECHO                                                     '__invoke+called%21'
   19     1      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FreFPi%3A17%241

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/reFPi
function name:  bar
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FreFPi%3A5%240'
          1        ASSIGN                                                   !0, ~1
    8     2        INIT_DYNAMIC_CALL                                        !0
          3        DO_FCALL                                      0          
    9     4      > RETURN                                                   null

End of function bar

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

End of function __invoke

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.26 ms | 1400 KiB | 15 Q