in_array

in_array -- Return true if a value exists in an array

Description

bool in_array(mixed needle, array haystack);

Searches haystack for needle and returns true if it is found in the array, false otherwise.

Example 1. in_array() example

$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os))
       print "Got Irix";
      

Note: This function was added in PHP 4.0.