Is there a function to determine whether a number is in a known array ?. Boolin_array (mixedneedle, arrayhaystack [, boolstrict]) searches for needle in haystack. If yes, TRUE is returned. otherwise, FALSE is returned. If the value of the third parameter strict is bool in_array (mixed needle, array haystack [, bool strict])
Search for needle in haystack. If yes, TRUE is returned. otherwise, FALSE is returned.
If the value of the third strict parameter is TRUE, the in_array () function checks whether the needle type is the same as that in haystack.
Note: If needle is a string, the comparison is case sensitive.
Note: Before PHP version 4.2.0, needle cannot be an array.
Example 1. in_array () example
$ OS = array ("Mac", "NT", "Irix", "Linux ");
If (in_array ("Irix", $ OS )){
Print "Got Irix ";
}
If (in_array ("mac", $ OS )){
Print "Got mac ";
}
Http://www.bkjia.com/PHPjc/632396.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/632396.htmlTechArticlebool in_array (mixed needle, array haystack [, bool strict]) searches for needle in haystack, returns TRUE if found, otherwise returns FALSE. If the value of the third parameter strict is...