Web >> Development >> PHP >>  How to test whether a value exists in an array

eg. $haystack = array("one","two","three"); $needle = "two"; then in_array($needle,$haystack); returns TRUE whilst in_array("four",$haystack); returns FALSE