if (in_array('o', $a)) {
echo "'o' was foundn";
}
?>
The above example will output:
'ph' was found
'o ' was found
Things to note:
If:
First declare an array as:
$arr = array(
*
);
Then:
in_array(0, $arr) == true
Puzzling!
{Weak language}
Solution:
in_array(strval(0), $arr, true))
http://www.bkjia.com/PHPjc/321552.html
www.bkjia.comtrue
http: //www.bkjia.com/PHPjc/321552.html
TechArticle
in_array (PHP 4, PHP 5) in_array — Check whether a certain value exists in the array. Instructions for copying the code are as follows: bool in_array ( mixed $needle , array $haystack [, bool $strict ] ) in h...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn