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! Quote 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.!= Quote 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 Quote 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 } Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.