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 ";
}
if (in_array(1.13, $a, true)) {
echo "1.13 found with strict check ";
}
?>
上例将输出:
1.13 found with strict check

原文地址:https://www.cnblogs.com/Alight/p/4311765.html