PHP 4.0 Bug #6152 Updated: count() function not returning proper value
| From: | Bug Database | Date: | Mon, 14 Aug 2000 19:34:04 +0000 |
| Subject: | PHP 4.0 Bug #6152 Updated: count() function not returning proper value | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-28850@lists.php.net to get a copy of this message | ||
ID: 6152
Updated by: zak
Reported By: jdoyon@nrcan.gc.ca
Status: Closed
Bug Type: Misbehaving function
Assigned To:
Comments:
This is not a bug - this is the way that php handles arrays.
PHP considers all arrays to be associative arrays.
For example:
$array[9] = 1;
$array[2] = 1;
count ($array) will return a value of two, even though the last element in the array looks like it
is positioned at the 10th numeric index in the array.
Since indexes 0 and 1, and 3 to 8 are not set, then they are not counted.
Full Bug description available at: http://bugs.php.net/?id=6152