3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo(&$bar) { $bar = 1; return 1; } $arg = 0; $called = 0; $called=call_user_func_array2('foo', array(0)); var_dump(array('arg'=>$arg, 'called'=>$called)); $arg = 0; $called = 0; $called=call_user_func_array2('foo', array($arg)); var_dump(array('arg'=>$arg, 'called'=>$called)); $arg = 0; $called = 0; $called=call_user_func_array2('foo', array(&$arg)); var_dump(array('arg'=>$arg, 'called'=>$called)); function call_user_func_array2($f, $args) { $args2=array(); foreach($args as $k=>$v) $args2[$k] = &$args[$k]; return call_user_func_array($f, $args2); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rJ2TZ
function name:  (null)
number of ops:  39
compiled vars:  !0 = $arg, !1 = $called
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 0
          1        ASSIGN                                                   !1, 0
          2        INIT_FCALL_BY_NAME                                       'call_user_func_array2'
          3        SEND_VAL_EX                                              'foo'
          4        SEND_VAL_EX                                              <array>
          5        DO_FCALL                                      0  $4      
          6        ASSIGN                                                   !1, $4
          7        INIT_FCALL                                               'var_dump'
          8        INIT_ARRAY                                       ~6      !0, 'arg'
          9        ADD_ARRAY_ELEMENT                                ~6      !1, 'called'
         10        SEND_VAL                                                 ~6
         11        DO_ICALL                                                 
    9    12        ASSIGN                                                   !0, 0
         13        ASSIGN                                                   !1, 0
         14        INIT_FCALL_BY_NAME                                       'call_user_func_array2'
         15        SEND_VAL_EX                                              'foo'
         16        INIT_ARRAY                                       ~10     !0
         17        SEND_VAL_EX                                              ~10
         18        DO_FCALL                                      0  $11     
         19        ASSIGN                                                   !1, $11
         20        INIT_FCALL                                               'var_dump'
         21        INIT_ARRAY                                       ~13     !0, 'arg'
         22        ADD_ARRAY_ELEMENT                                ~13     !1, 'called'
         23        SEND_VAL                                                 ~13
         24        DO_ICALL                                                 
   10    25        ASSIGN                                                   !0, 0
         26        ASSIGN                                                   !1, 0
         27        INIT_FCALL_BY_NAME                                       'call_user_func_array2'
         28        SEND_VAL_EX                                              'foo'
         29        INIT_ARRAY                                       ~17     !0
         30        SEND_VAL_EX                                              ~17
         31        DO_FCALL                                      0  $18     
         32        ASSIGN                                                   !1, $18
         33        INIT_FCALL                                               'var_dump'
         34        INIT_ARRAY                                       ~20     !0, 'arg'
         35        ADD_ARRAY_ELEMENT                                ~20     !1, 'called'
         36        SEND_VAL                                                 ~20
         37        DO_ICALL                                                 
   16    38      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rJ2TZ
function name:  foo
number of ops:  4
compiled vars:  !0 = $bar
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    4     1        ASSIGN                                                   !0, 1
    5     2      > RETURN                                                   1
    6     3*     > RETURN                                                   null

End of function foo

Function call_user_func_array2:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 11
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/rJ2TZ
function name:  call_user_func_array2
number of ops:  18
compiled vars:  !0 = $f, !1 = $args, !2 = $args2, !3 = $v, !4 = $k
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        ASSIGN                                                   !2, <array>
   14     3      > FE_RESET_R                                       $6      !1, ->11
          4    > > FE_FETCH_R                                       ~7      $6, !3, ->11
          5    >   ASSIGN                                                   !4, ~7
          6        FETCH_DIM_W                                      $10     !1, !4
          7        MAKE_REF                                         $11     $10
          8        FETCH_DIM_W                                      $9      !2, !4
          9        ASSIGN_REF                                               $9, $11
         10      > JMP                                                      ->4
         11    >   FE_FREE                                                  $6
   15    12        INIT_USER_CALL                                0          'call_user_func_array', !0
         13        SEND_ARRAY                                               !2
         14        CHECK_UNDEF_ARGS                                         
         15        DO_FCALL                                      0  $13     
         16      > RETURN                                                   $13
   16    17*     > RETURN                                                   null

End of function call_user_func_array2

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
182.65 ms | 948 KiB | 16 Q