3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo1() { echo __FUNCTION__, "\n"; } class Foo { static function do_foo() { echo __METHOD__, "\n"; } } $funs = array( 'foo1', array(new Foo(), 'do_foo'), function () { echo __FUNCTION__, "\n"; }, 'Foo::do_foo', ); foreach ($funs as $fun) { echo "call_user_func(): "; call_user_func($fun); echo "direct call: "; $fun(); }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/WBWVR
function name:  (null)
number of ops:  21
compiled vars:  !0 = $funs, !1 = $fun
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_ARRAY                                       ~2      'foo1'
   12     1        NEW                                              $3      'Foo'
          2        DO_FCALL                                      0          
          3        INIT_ARRAY                                       ~5      $3
          4        ADD_ARRAY_ELEMENT                                ~5      'do_foo'
          5        ADD_ARRAY_ELEMENT                                ~2      ~5
   13     6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWBWVR%3A13%240'
          7        ADD_ARRAY_ELEMENT                                ~2      ~6
   14     8        ADD_ARRAY_ELEMENT                                ~2      'Foo%3A%3Ado_foo'
   10     9        ASSIGN                                                   !0, ~2
   18    10      > FE_RESET_R                                       $8      !0, ->19
         11    > > FE_FETCH_R                                               $8, !1, ->19
   19    12    >   ECHO                                                     'call_user_func%28%29%3A+'
         13        INIT_USER_CALL                                0          'call_user_func', !1
         14        DO_FCALL                                      0          
   20    15        ECHO                                                     'direct+call%3A+'
         16        INIT_DYNAMIC_CALL                                        !1
         17        DO_FCALL                                      0          
   18    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $8
   21    20      > RETURN                                                   1

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

End of function foo1

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

End of function %00%7Bclosure%7D%2Fin%2FWBWVR%3A13%240

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

End of function do_foo

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.07 ms | 1399 KiB | 13 Q