TomTees Posted September 30, 2010 Share Posted September 30, 2010 Can someone help me to get this code working... public function getBowlContents(){ if is_null($this->contents) { return "The bowl is empty!"; } else { return "The bowl contains " . $this->contents . " soup!"; } TomTees Quote Link to comment https://forums.phpfreaks.com/topic/214794-if-then-else-and-checking-for-null/ Share on other sites More sharing options...
Alex Posted September 30, 2010 Share Posted September 30, 2010 You need parenthesis around the condition. if (is_null($this->contents)) { Quote Link to comment https://forums.phpfreaks.com/topic/214794-if-then-else-and-checking-for-null/#findComment-1117454 Share on other sites More sharing options...
TomTees Posted September 30, 2010 Author Share Posted September 30, 2010 You need parenthesis around the condition. if (is_null($this->contents)) { Thanks!!! Quote Link to comment https://forums.phpfreaks.com/topic/214794-if-then-else-and-checking-for-null/#findComment-1117571 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.