in_array(), php array function to find the match in an array

The in_array() function searches an array for a specific value.

This function returns TRUE if the value is found in the array, or FALSE otherwise.

 

Example

<?php $anyArray = array("Patty","Susan","Amy","Clara");
$find = "Heather"; $result = in_array($find, $anyArray);
if ($result == true){
 echo "$find is in the array";
} else {
 echo "$find is NOT in the array"; } ?>

Output

Heather is NOT in the array