in_array 检查数组中是否存在某个值 &reftitle.description; boolin_array mixedneedle arrayhaystack boolstrict&false; haystack 中搜索 needle,如果没有设置 strict 则使用宽松的比较。 &reftitle.parameters; needle 待搜索的值。 如果 needle 是字符串,则比较是区分大小写的。 haystack 这个数组。 strict 如果第三个参数 strict 的值为 &true; 则 in_array 函数还会检查 needle类型是否和 haystack 中的相同。 &reftitle.returnvalues; 如果找到 needle 则返回 &true;,否则返回 &false;。 &reftitle.changelog; &Version; &Description; 4.2.0 在 PHP 版本 4.2.0 之前,needle 不允许是一个数组。 &reftitle.examples; <function>in_array</function> 例子 ]]> 第二个条件失败,因为 in_array 是区分大小写的,所以以上程序显示为: <function>in_array</function> 严格类型检查例子 ]]> &example.outputs; <function>in_array</function> 中用数组作为 needle ]]> &example.outputs; &reftitle.seealso; array_search isset array_key_exists