好吧,我们可以看看源代码:
[/ext/standard/array.c](https://github.com/php/php-src/blob/PHP-5.3/ext/standard/array.c#L300)
PHP_FUNCTION(count)call
php_count_recursive(),这反过来又需要
zend_hash_num_elements()非递归数组,该数组是通过以下方式实现的:
ZEND_API int zend_hash_num_elements(const HashTable *ht){ IS_ConSISTENT(ht); return ht->nNumOfElements;}所以你可以看到,它
O(1)的
$mode = COUNT_NORMAL。



