3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function bar() { echo "a"; } public function __invoke() { echo 'wtf'; } } var_dump((new Foo)->bar()); 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/5vAjC
function name:  (null)
number of ops:  20
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'bar'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
    7     7        INIT_FCALL_BY_NAME                                       'fb_intercept'
          8        SEND_VAL_EX                                              'Foo%3A%3A__invoke'
          9        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F5vAjC%3A7%240'
         10        SEND_VAL_EX                                              ~4
         11        DO_FCALL                                      0          
    9    12        INIT_FCALL                                               'var_dump'
         13        NEW                                              $6      'Foo'
         14        DO_FCALL                                      0          
         15        INIT_METHOD_CALL                                         $6, 'bar'
         16        DO_FCALL                                      0  $8      
         17        SEND_VAR                                                 $8
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

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

End of function %00%7Bclosure%7D%2Fin%2F5vAjC%3A7%240

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/5vAjC
function name:  bar
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ECHO                                                     'a'
          1      > 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/5vAjC
function name:  __invoke
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
          0  E >   ECHO                                                     'wtf'
          1      > RETURN                                                   null

End of function __invoke

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.98 ms | 1396 KiB | 15 Q