john.muckley Posted April 8, 2013 Share Posted April 8, 2013 Hey guys, I'm used to being able use if statements that say 'if value is anything other than x then...' (if variable <> test, do something). Is it possible to use IF in the same way in PHP? If so, how? Thanks in advance! Link to comment https://forums.phpfreaks.com/topic/276699-help-with-php-if-statements/ Share on other sites More sharing options...
Jessica Posted April 8, 2013 Share Posted April 8, 2013 Did you read the manual? Because that's kind of a basic thing.!= Link to comment https://forums.phpfreaks.com/topic/276699-help-with-php-if-statements/#findComment-1423600 Share on other sites More sharing options...
john.muckley Posted April 8, 2013 Author Share Posted April 8, 2013 i know it is, and i thought != was the answer, but my script isnt working properly and i thought perhaps i'd got it wrong. Problem must be elsewhere! Thanks for the reply Jessica Link to comment https://forums.phpfreaks.com/topic/276699-help-with-php-if-statements/#findComment-1423601 Share on other sites More sharing options...
Xyphon Posted April 9, 2013 Share Posted April 9, 2013 if(statement) { result } else { result } Link to comment https://forums.phpfreaks.com/topic/276699-help-with-php-if-statements/#findComment-1423613 Share on other sites More sharing options...
BuildMyWeb Posted April 9, 2013 Share Posted April 9, 2013 john, you are correct. != or <> in php. there is also !== which says, 'not identical'. the latter is more comprehensive in that the VALUE and the TYPE are both not equal. http://php.net/manual/en/language.operators.comparison.php Link to comment https://forums.phpfreaks.com/topic/276699-help-with-php-if-statements/#findComment-1423630 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.