3v4l.org

run code in 300+ PHP versions simultaneously
<?php function userland_call_user_func(callable $function, ...$args) { return $function(...$args); } class Foo { function bar() { var_dump('bar'); } } call_user_func(array(new Foo, 'bar')); userland_call_user_func(array(new Foo, 'bar'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iGlrH
function name:  (null)
number of ops:  14
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   NEW                                              $0      'Foo'
          1        DO_FCALL                                      0          
          2        INIT_ARRAY                                       ~2      $0
          3        ADD_ARRAY_ELEMENT                                ~2      'bar'
          4        INIT_USER_CALL                                0          'call_user_func', ~2
          5        DO_FCALL                                      0          
   12     6        INIT_FCALL                                               'userland_call_user_func'
          7        NEW                                              $4      'Foo'
          8        DO_FCALL                                      0          
          9        INIT_ARRAY                                       ~6      $4
         10        ADD_ARRAY_ELEMENT                                ~6      'bar'
         11        SEND_VAL                                                 ~6
         12        DO_FCALL                                      0          
         13      > RETURN                                                   1

Function userland_call_user_func:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/iGlrH
function name:  userland_call_user_func
number of ops:  8
compiled vars:  !0 = $function, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1        RECV_VARIADIC                                    !1      
          2        INIT_DYNAMIC_CALL                                        !0
          3        SEND_UNPACK                                              !1
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      1  $2      
          6      > RETURN                                                   $2
          7*     > RETURN                                                   null

End of function userland_call_user_func

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

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
282.06 ms | 1398 KiB | 17 Q