note 4178 modified in array_reverse by ronabop
| From: | ronabop@php.net | Date: | Wed, 18 Oct 2000 04:30:00 +0000 |
| Subject: | note 4178 modified in array_reverse by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-6619@lists.php.net to get a copy of this message | ||
As a further clarification: key-value pairs have an order within an array completely separate from
whatever the keys happen to be - the order in which you add them. This is the order that functions
like each() and next() will move their pointer through the array.
If you add to an array without specifying the key, like $array[] = value; then an internal counter
supplies the key value and then the numerical order of your keys will be identical to the the
internal order. If you "leave holes" - jumping ahead by specifying a higher number for
the key, like $array[1000] = value; the internal counter gets pushed forward appropriately. Other
than its effect on this internal counter, specifying a numerical key seems no different than
specifying a string.
However, some array functions, like array_merge() and array_reverse() treat keys that are numbers
differently from keys that are not.
http://www.php.net/manual/function.array-reverse.php