I got an error: Strict Standards: Only variables should be passed by reference
$string = array_shift(array_keys($_REQUEST));
How can I correct that ?
$tmpArray = array_keys($_REQUEST);
$string = array_shift($tmpArray);
Temporary array needed :(
Assign the result of array_keys($_REQUEST)
to a variable and pass that variable to array_shift
:
$var = array_keys($_REQUEST);
$string = array_shift($var);
You might have a set up PHP to run under strict mode or it might have been the default behaviour.
Since output of array_keys($_REQUEST) is not a variable and under strict mode this will generate a warning. This behavior is extremely non-intuitive as the array_keys($_REQUEST) method returns an array value.
So to resolve this problem, assign the output of array_keys($_REQUEST) to a variable and then use it like below:
$keys = array_keys($_REQUEST);
$shift = array_shift($keys);
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