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:
array_pop($myarray);
Or use call_user_func_array()
, which accepts an array of references as parameters without yelling at you about call-time pass-by-reference:
call_user_func_array('array_pop', array(&$myarray));
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With