(PHP 4 >= 4.0.0)
in_array -- Vrátit
TRUE, pokud v poli existuje daná hodnota
Popis
bool in_array
(mixed needle, array haystack, bool strict)
Hledá v haystack needle
a pokud ji najde, vrací TRUE, jinak
FALSE.
Pokud je třetí argument strict TRUE,
in_array() také kontroluje typ needle
v haystack.
Příklad 1. Ukázka in_array()
$os = array ("Mac", "NT", "Irix", "Linux");
if (in_array ("Irix", $os)){
print "Got Irix";
}
|
|
Příklad 2. Ukázka in_array() s argumentem strict
// Výstup bude:
1.13 found with strict check
|
|