bool in_array( mixed needle, array array [, bool strict] )
| 参数 | 说明 |
|---|---|
| needle | 需要在数组中搜索的值,如果是字符串,则区分大小写 |
| array | 需要检索的数组 |
| strict | 可选,如果设置为 TRUE ,则还会对 needle 与 array 中的值类型进行检查 |
<?php
$os = array("Mac", "NT", "Irix", "Linux");
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {
echo "Got mac";
}
?>
<?php
$europe = array("美国","英国","法国","德国","意大利","西班牙","丹麦");
if (in_array("美国",$europe)) {
echo "True";
}
?>
<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check ";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict check ";
}
?>
<?php
$a = array(array('p', 'h'), array('p', 'r'), 'o');
if (in_array(array('p', 'h'), $a)) {
echo "'ph' was found ";
}
if (in_array(array('f', 'i'), $a)) {
echo "'fi' was found ";
}
if (in_array('o', $a)) {
echo "'o' was found ";
}
?>
bool in_array(mixed $needle,array $haystack [, bool $strict = FALSE ])
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有