PHP in_array()


in_array(needle, array, strict=false) checks whether a value is in an array or not. It is case sensitive.

<?PHP
	$arr=array(1,2,3,4,5,6,7,8,9);
    if (in_array(3,$arr)) echo "3 is an array element";
	//3 is an array element
?>

If strict=true, the value's type will also be checked.
<?PHP
    $arr=array("2.3",4,9,10);
	if (in_array("4",$arr,true)) echo "4 is in the array";
	if (in_array("2.3",$arr,true)) echo "2.3 is in the array";
	//2.3 is in the array
?>