$arr=array('aa','bb','cc');
$brr=array('1'=>'aa','2'=>'bb');
function test ($param){
}
test($arr);
test($brr);
1
foccy 2015-07-19 21:04:18 +08:00
不知道是什么情况下需要这样的需求。不过这里有答案: http://stackoverflow.com/questions/173400/how-to-check-if-php-array-is-associative-or-sequential
|
2
yakczh OP [B_is_associative] => 0.26401352882385
[B_ais_assoc] => 0.24301218986511 [B_is_assoc] => 0.13501119613647 [B_arrayIsAssociative] => 0.12200903892517 [B_isNumericArray] => 0.12200570106506 isNumericArray 最快 |