Use the in_array()
function.
Manual says:
Searches haystack for needle using loose comparison unless strict is set.
Example:
<?php
$a="abc";
if (in_array($a, array('are','abc','xyz','lmn'))) {
echo "Got abc";
}
?>
More Related Contents:
- How do I get a file name from a full path with PHP?
- select count(*) from table of mysql in php
- Loading .sql files from within PHP
- PHPUnit assert that an exception was thrown?
- How to get the character from unicode code point in PHP?
- PHP Commands Out of Sync error
- How to check if string is a valid XML element name?
- how to check and set max_allowed_packet mysql variable [duplicate]
- PHP check file extension [duplicate]
- Title case a string containing one or more last names while handling names with apostrophes
- Is there a PHP function to convert a query string to an array?
- php return only duplicated entries from an array
- MySql Error: 1364 Field ‘display_name’ doesn’t have default value
- Detect clients with Proxy Servers via PHP [duplicate]
- Cakephp-3.x: How to change the data type of a selected alias?
- How I can create installer for website. PHP mysql [closed]
- PHP, Get tomorrows date from date
- DEFINE vs Variable in PHP
- PHP regular expression – filter number only
- Error while writting Arabic to image
- How to add anchor tag to a URL from text input
- Header in PDF page using DOMPDF in PHP
- Remove item from array if it exists in a ‘disallowed words’ array
- How to run the bind_param() statement in PHP?
- Getting the difference between two time/dates using php?
- How to get random image from directory using PHP
- Parsing HTTP_RANGE header in PHP
- What is the PDO equivalent of function mysql_real_escape_string?
- Installing PDO driver on MySQL Linux server
- Undefined index error PHP