php容易忽视的地方

一:bool in_array ( mixed $needle , array $haystack [, bool $strict ] )   

用的时候加最后一个参数,判断类型

<?php
$a = array('1.10', 12.4, 1.13);
if (in_array('12.4', $a, true)) {
echo "'12.4' found with strict check\n";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict check\n";
}
?>
上例将输出:
1.13 found with strict check

posted @ 2015-03-03 19:04  一束光  阅读(145)  评论(0编辑  收藏  举报

友情链接

CFC4N