3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { $args = func_get_args(); var_dump($args); } } $input = new StdClass(); $input->method = array('Foo', 'bar'); $input->args = array(123, 456); call_user_func_array($method, $args); // NOT WORKING call_user_func_array($method, (array) $args); // NOT WORKING it just don't goes in the methods call call_user_func_array($method, array((array) $args)); // WORKING !!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SMN72
function name:  (null)
number of ops:  23
compiled vars:  !0 = $input, !1 = $method, !2 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   NEW                                              $3      'StdClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   14     3        ASSIGN_OBJ                                               !0, 'method'
          4        OP_DATA                                                  <array>
   15     5        ASSIGN_OBJ                                               !0, 'args'
          6        OP_DATA                                                  <array>
   19     7        INIT_USER_CALL                                0          'call_user_func_array', !1
          8        SEND_ARRAY                                               !2
          9        CHECK_UNDEF_ARGS                                         
         10        DO_FCALL                                      0          
   21    11        INIT_USER_CALL                                0          'call_user_func_array', !1
         12        CAST                                          7  ~9      !2
         13        SEND_ARRAY                                               ~9
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      0          
   23    16        INIT_USER_CALL                                0          'call_user_func_array', !1
         17        CAST                                          7  ~11     !2
         18        INIT_ARRAY                                       ~12     ~11
         19        SEND_ARRAY                                               ~12
         20        CHECK_UNDEF_ARGS                                         
         21        DO_FCALL                                      0          
         22      > RETURN                                                   1

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

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.14 ms | 1396 KiB | 15 Q