标签:
常用方式:is_int(), is_float()l, is_numeric(), is_array()...
另一种更快捷的方式:用 === 或 !== ,即全等和不全等运算符来判断。
I‘ve found a faster way of determining an array. If you use is_array() millions of times, you will notice a *huge* difference. On my machine, this method takes about 1/4 the time of using is_array().
Cast the value to an array, then check (using ===) if it is identical to the original.
<?php
if ( (array) $unknown !== $unknown ) {
echo ‘$unknown is not an array‘;
} else {
echo ‘$unknown is an array‘;
}
?>
http://php.net/manual/zh/function.is-array.php
标签:
原文地址:http://www.cnblogs.com/lxpursue/p/5170332.html