shane18 Posted December 14, 2009 Share Posted December 14, 2009 Why does empty($USER_ID = $_SESSION["USER_ID"]) create this error... Parse error: syntax error, unexpected '=', expecting ')' in /home3/finestto/public_html/index.php on line 17 Quote Link to comment https://forums.phpfreaks.com/topic/185057-empty-error/ Share on other sites More sharing options...
PFMaBiSmAd Posted December 14, 2009 Share Posted December 14, 2009 Note: empty() only checks variables as anything else will result in a parse error. You are asking it to check the result of an assignment statement. Quote Link to comment https://forums.phpfreaks.com/topic/185057-empty-error/#findComment-976829 Share on other sites More sharing options...
shane18 Posted December 14, 2009 Author Share Posted December 14, 2009 Well, why does that work in other x() functions? like while or etc... Quote Link to comment https://forums.phpfreaks.com/topic/185057-empty-error/#findComment-976832 Share on other sites More sharing options...
corbin Posted December 14, 2009 Share Posted December 14, 2009 The statement $a = $b returns the value of b. Example: $x = 5; var_dump($y = $x); Will say 5. But, as thorpe said, empty() only checks variables. It does not return a variable to do $x = $y, but rather a temporary value. Quote Link to comment https://forums.phpfreaks.com/topic/185057-empty-error/#findComment-976833 Share on other sites More sharing options...
shane18 Posted December 14, 2009 Author Share Posted December 14, 2009 oh... i was just trying to save me a line of code... i like to be compact lol Quote Link to comment https://forums.phpfreaks.com/topic/185057-empty-error/#findComment-976835 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.