Ok I'm working through the PHP login series and on the first video I ran in to a problem writing:
echo end(explode('/', $_SERVER['SCRIPT_NAME']));
It gave me this error:
Strict Standards: Only variables should be passed by reference in C:\xampp\htdocs\user_system\core\init.inc.php on line 5
protected.php
Of course it still returned the protected.php part but gives an error, after a bit of reading I found that newer versions of PHP a reference has to be a variable.
I will work on this and get back to you all on it, or maybe i should sit it out and this gets fixed later in the tutorial?
Without trying to poke a stick in a hornets nest, would It be wise to carry on doing it the way PHP wants us to, in strict mode, or is it just not worth the hassle and disable it?
twiggy wrote:would It be wise to carry on doing it the way PHP wants us to, in strict mode, or is it just not worth the hassle and disable it?
Well there does not seem to be a performance difference, so I'm not entirely sure why php prefers you not to pass functions like that. I work with those errors hidden. I guess it's up to you
Hmm I will decide that once I know and understand more about PHP, I guess there is thought behind it, rite or wrong.
I'm just thinking a head in to the future when I share my scripts and pass them around I will want to make sure they work across many environments and platforms as possible so it looks like it could be worth me researching in to E_STRICT and E_ALL to show any possible conflicts in my code. Any thoughts on this welcome
You can set the error_reporting level in the script itself using the error_reporting() function. And it's still up to you, like you say there must be some reason for the messages so if you don't find it too much of a pain I guess it is a good idea to follow them.