in_array(value,array,type)
<?php
$people = array("Peter", "Joe", "Glenn", "Cleveland");
if(in_array("Glenn", $people)) {
echo"Match found";
}else{
echo"Match not found";
}
?>
输出:
Match foundarray_key_exists(key,array)
<?php
$a = array("a"=>"Dog", "b"=>"Cat");
if(array_key_exists("a", $a)) {
echo"Key exists!";
}else{
echo"Key does not exist!";
}
?>
输出:
Key exists!array_search(value,array,strict)
<?php
$a = array("a" => "Dog", "b" => "Cat", "c" => 5, "d" => "5");
echo array_search("Dog", $a);
echo array_search("5", $a);
?>
输出:
ac





























