Use the in_array()
function.
$array = array('kitchen', 'bedroom', 'living_room', 'dining_room');
if (in_array('kitchen', $array)) {
echo 'this array contains kitchen';
}
More Related Contents:
- fetch data inmultidimensional array in PHP [closed]
- PHP multidimensional array search by value
- Split a comma-delimited string into an array?
- How to sum all column values in multi-dimensional array?
- How to convert JSON string to array
- Modify array values in foreach loop
- How to check if PHP array is associative or sequential?
- mysqli bind_param() expected to be a reference, value given
- Build a tree from a flat array in PHP
- Implode an array with “, ” and add “and ” before the last item
- PHP sort array by two field values [duplicate]
- Cartesian Product of N arrays
- Convert a comma-delimited string into array of integers?
- How to re-index the values of an array in PHP? [duplicate]
- filter values from an array similar to SQL LIKE ‘%search%’ using PHP
- Convert array of single-element arrays to a one-dimensional array
- Type hinting – specify an array of objects
- Check if string contains a value in array [duplicate]
- Convert an associative array to a simple array of its values in php
- CSV to Associative Array
- Check if a specific value exists at a specific key in any subarray of a multidimensional array
- How to pass an array via $_GET in php?
- How to create an empty array in PHP with predefined size?
- Move an array element to a new index in PHP
- PHP get all arguments as array?
- Convert PHP array string into an array
- Remove zero values from a PHP array
- How to iterate through a nested stdClass? [duplicate]
- PHP convert nested array to single array while concatenating keys?
- Group array data on one column and sum data from another column to form a flat associative array