Place the values in an array, then use the function in_array() to check if they exist.
$checkVars = array(3, 4, 5, "string", "2010-05-16");
if(in_array($var, $checkVars)){
// Value is found.
}
More Related Contents:
- What are the PHP operators “?” and “:” called and what do they do?
- How to replace “if” statement with a ternary operator ( ? : )?
- PHP ternary operator vs null coalescing operator
- PHP Elvis operator vs null coalescing operator
- ?: operator (the ‘Elvis operator’) in PHP
- What is ?: in PHP 5.3? [duplicate]
- PHP short-ternary (“Elvis”) operator vs null coalescing operator
- Conditionally add associative element to array
- What to put in database columns when creating registration/login system? (xampp)
- Forcing to download a file using PHP
- mysqli_fetch_array() expects parameter 1 to be mysqli_result, boolean given in [duplicate]
- PHP check if file is an image [duplicate]
- How to access PHP with the Command Line on Windows?
- encrypt and decrypt md5
- SimpleXML and print_r() – why is this empty?
- How to convert string to boolean php
- How to get the value after the hash in “somepage.php#name”?
- PHP absolute path to root
- Why I can not login to magento backend using google chrome
- PHP: Split multibyte string (word) into separate characters
- How to convert text to SVG paths?
- calculate the time when the sun is X degrees below/above the Horizon
- Are the PHP preg_functions multibyte safe?
- PHP cURL how to add the User Agent value OR overcome the Servers blocking cURL requests?
- How to replace all XHTML/HTML line breaks () with new lines?
- Alternate to array_column()
- count() parameter must be an array or an object that implements countable in laravel
- Remove Non English Characters PHP
- how to enable shell_exec and exec on php?
- Check if a file was included or loaded