in_array

(PHP 4 >= 4.0.0)

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

설명

bool in_array (mixed needle, array haystack)

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

예 1. in_array() example


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