3v4l.org

run code in 300+ PHP versions simultaneously
<?php function userland_call_user_func(callable $function, ...$args) { return $function(...$args); } class Test { private function foo($bar) { echo new Exception; } public function call($callfunc) { $callfunc(array($this, 'foo'), 'bar'); } } $o = new Test; $o->call('call_user_func'); $o->call('userland_call_user_func');
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ZCOM
function name:  (null)
number of ops:  10
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        INIT_METHOD_CALL                                         !0, 'call'
          4        SEND_VAL_EX                                              'call_user_func'
          5        DO_FCALL                                      0          
   12     6        INIT_METHOD_CALL                                         !0, 'call'
          7        SEND_VAL_EX                                              'userland_call_user_func'
          8        DO_FCALL                                      0          
          9      > 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/7ZCOM
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 Test:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ZCOM
function name:  foo
number of ops:  5
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        NEW                                              $1      'Exception'
          2        DO_FCALL                                      0          
          3        ECHO                                                     $1
          4      > RETURN                                                   null

End of function foo

Function call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/7ZCOM
function name:  call
number of ops:  9
compiled vars:  !0 = $callfunc
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        INIT_DYNAMIC_CALL                                        !0
          2        FETCH_THIS                                       ~1      
          3        INIT_ARRAY                                       ~2      ~1
          4        ADD_ARRAY_ELEMENT                                ~2      'foo'
          5        SEND_VAL_EX                                              ~2
          6        SEND_VAL_EX                                              'bar'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   null

End of function call

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.13 ms | 1390 KiB | 13 Q