赞
踩
echo “(1)”;
if (in_array("Irix", $os)) {
echo "Got Irix";
}
if (in_array("mac", $os)) {//in_array() 是区分大小写的
echo "Got mac";
}
$a = array('1.10', 12.4, 1.13);
echo "(2)";
if (in_array('12.4', $a, true)) {//in_array() 严格类型检查
echo "'12.4' found with strict checkn";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict checkn";
}
$a = array(array('p', 'h'), array('p', 'r'), 'o');
echo "(3)";
if (in_array(array('p', 'h'), $a)) {
echo "'ph' was foundn";
}
if (in_array(array('f', 'i'), $a)) {//in_array() 中用数组作为 needle
echo "'fi' was foundn";
}
if (in_array('o', $a)) {
echo "'o' was foundn";
}
?>
程序运行结果是:
(1)Got Irix
(2)1.13 found with strict check
(3)'ph' was found 'o' was found
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。