Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
I have upgraded PHP from v5.3 to v5.4 and I am now getting the following error:
Strict standards: Only variables should be passed by reference
Code:
$filename = array_pop(explode("/", $_SERVER['SCRIPT_FILENAME']));
How to fix this?
$filename_arr = explode("/", $_SERVER['SCRIPT_FILENAME']); $filename = array_pop($filename_arr);
array_pop
Breaking the code apart would resolve the error
$filename = explode("/", $_SERVER['SCRIPT_FILENAME']); $filename = array_pop($filename); echo $filename ;
Demo Break Apart
Add a comment
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.
$filename_arr = explode("/", $_SERVER['SCRIPT_FILENAME']); $filename = array_pop($filename_arr);array_popexpects a variable as it tries to remove the last item from it.