check if exit value in array php code example
Example 1: in_array
<?php
/**
in_array ( mixed $needle , array $haystack [, bool $strict = FALSE ] ) : bool
*/
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {
echo "Got mac";
}
?>
Example 2: in_array
<?
in_array("Irix", $os);
?>