- var_dump: documentation ( source)
<?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 );