See if Value Exists in PHP Array

in_array is the function to Check if a value exists in an array using PHP. Here is an example of how it is used:

 

$arr = array("abc", "def", "ghi", "jkl");
if (in_array("abc", $arr)) {
echo "<p>abc is in arr!</p>";
}

Leave a Reply

Your email address will not be published. Required fields are marked *