Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save omurphy27/8cadee1e356afd6666ee to your computer and use it in GitHub Desktop.
Save omurphy27/8cadee1e356afd6666ee to your computer and use it in GitHub Desktop.
PHP checking if a variable is not equal to multiple conditions.php
<?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