You can easily find value in array with multple methods in array.
Method 1
Method 1 – in_array function
In array function will search for specific value in array and return TRUE if value found or FALSE in case of not value not found.
<?php
$cars = array("BMW", "mercedes", "audi", "ford", 23);
if (in_array("ford", $people, TRUE))
{
echo "value found<br>";
}
else
{
echo "value not found<br>";
}
?>
Methhod 2 – array_search function
array_search also do the same and can be use to search value in array. however it return the key if value found otherwise false.
<?php
$array = array(0 => 'BMW', 1 => 'mercedes', 2 => 'audi', 3 => 'ford');
$key = array_search('audi', $array); // result will be in this case = $key = 3;
$key = array_search('BMW', $array); // result will be in this case = $key = 0;
?>