note 1033 deleted from sizeof by danbeck
| From: | danbeck@php.net | Date: | Tue, 19 Jun 2001 21:26:28 +0000 |
| Subject: | note 1033 deleted from sizeof by danbeck | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-14464@lists.php.net to get a copy of this message | ||
If you're used to arrays in other languages, this function may trip you up: it returns the
number of elements in the array that is actually filled.
If only myarray[2] has a value and mayarray[0] and myarray[1] do not, then *sizeof(mayarray)* will
return *1*, not *3*.
This is caused by the fact that arrays here are actually always associative arrays. If you're
filling some elements of the array using an index counter, you may want to save the counter value
for the highest element to access the array later on.
count() does the same thing: it also returns only the number of actually _filled_ elements.