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 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)) { 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!!! 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
Archived
This topic is now archived and is closed to further replies.