3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static function bar() { $args = func_get_args(); var_dump($args); } } $method = array('Foo', 'bar'); $args = 123; call_user_func($method, $args); // NOT WORKING it just don't goes in the methods call call_user_func($method, 123); // NOT WORKING it just don't goes in the methods call call_user_func($method, (int) 123); // WORKING !! $method = array('Foo', 'bar'); $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/nBlBJ
function name:  (null)
number of ops:  30
compiled vars:  !0 = $method, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   ASSIGN                                                   !0, <array>
   14     1        ASSIGN                                                   !1, 123
   17     2        INIT_USER_CALL                                1          'call_user_func', !0
          3        SEND_USER                                                !1
          4        DO_FCALL                                      0          
   19     5        INIT_USER_CALL                                1          'call_user_func', !0
          6        SEND_USER                                                123
          7        DO_FCALL                                      0          
   21     8        INIT_USER_CALL                                1          'call_user_func', !0
          9        CAST                                          4  ~6      123
         10        SEND_USER                                                ~6
         11        DO_FCALL                                      0          
   24    12        ASSIGN                                                   !0, <array>
   25    13        ASSIGN                                                   !1, <array>
   28    14        INIT_USER_CALL                                0          'call_user_func_array', !0
         15        SEND_ARRAY                                               !1
         16        CHECK_UNDEF_ARGS                                         
         17        DO_FCALL                                      0          
   30    18        INIT_USER_CALL                                0          'call_user_func_array', !0
         19        CAST                                          7  ~11     !1
         20        SEND_ARRAY                                               ~11
         21        CHECK_UNDEF_ARGS                                         
         22        DO_FCALL                                      0          
   32    23        INIT_USER_CALL                                0          'call_user_func_array', !0
         24        CAST                                          7  ~13     !1
         25        INIT_ARRAY                                       ~14     ~13
         26        SEND_ARRAY                                               ~14
         27        CHECK_UNDEF_ARGS                                         
         28        DO_FCALL                                      0          
         29      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/nBlBJ
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:
144.91 ms | 1396 KiB | 15 Q