3v4l.org

run code in 500+ PHP versions simultaneously
<?php function do_action_ref_array( $callback, $args ) { call_user_func_array( $callback, array_slice( $args, 0, 2 ) ); } $function = function( $arg1, &$arg2 ) { var_dump( $arg1, $arg2 ); return $arg1; }; $a = 1; $b = 2; $args = [$a, &$b]; do_action_ref_array( $function, $args );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AWr5p
function name:  (null)
number of ops:  12
compiled vars:  !0 = $function, !1 = $a, !2 = $b, !3 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          1        ASSIGN                                                       !0, ~4
   11     2        ASSIGN                                                       !1, 1
   12     3        ASSIGN                                                       !2, 2
   13     4        INIT_ARRAY                                           ~8      !1
          5        ADD_ARRAY_ELEMENT                                    ~8      !2
          6        ASSIGN                                                       !3, ~8
   15     7        INIT_FCALL                                                   'do_action_ref_array'
          8        SEND_VAR                                                     !0
          9        SEND_VAR                                                     !3
         10        DO_FCALL                                          0          
         11      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AWr5p
function name:  {closure:/in/AWr5p:7}
number of ops:  8
compiled vars:  !0 = $arg1, !1 = $arg2
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    8     2        INIT_FCALL                                                   'var_dump'
          3        SEND_VAR                                                     !0
          4        SEND_VAR                                                     !1
          5        DO_ICALL                                                     
    9     6      > RETURN                                                       !0
   10     7*     > RETURN                                                       null

End of Dynamic Function 0

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

End of function do_action_ref_array

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.23 ms | 2521 KiB | 15 Q