call_user_func('array_pop', $myarray);
gives ‘Parameter 1 to array_pop() expected to be a reference, value given’, while
call_user_func('array_pop', &$myarray);
gives ‘Call-time pass-by-reference has been deprecated’.
So what am I supposed to do? I am on “PHP Version 5.3.5” on Windows, and turning of deprecated warnings isn’t an option.
Thanks!
Either just call it directly:
Or use
call_user_func_array(), which accepts an array of references as parameters without yelling at you about call-time pass-by-reference:The reason this doesn’t raise a warning about call-time pass-by-reference is because nothing of that sort actually happens. There is a subtle difference between passing a variable by reference and creating an array of references and passing that array by value.