Created
April 17, 2015 05:18
-
-
Save omurphy27/8cadee1e356afd6666ee to your computer and use it in GitHub Desktop.
PHP checking if a variable is not equal to multiple conditions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// see here | |
// http://stackoverflow.com/questions/19949923/simpler-way-to-check-if-variable-is-not-equal-to-multiple-string-values | |
// php checking if a variable is not equal | |
// to multiple conditions | |
if ( !in_array($some_variable, array('uk','in'), true ) ) { | |
} | |
// is the same as here | |
if ( $some_variable !== 'uk' && $some_variable !== 'in' ) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment