note 28526 added to language.types.array
| From: | php-general at lists dot php dot net | Date: | Wed, 15 Jan 2003 23:28:56 +0000 |
| Subject: | note 28526 added to language.types.array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-42195@lists.php.net to get a copy of this message | ||
/* It helps to think of numeric indices
* in the same way as string indices...
* That is, the order in which they are
* added in determines the internal order,
* not the index. For example:
*/
// for string indices:
$foo["c"] = "c";
$foo["b"] = "b";
$foo["a"] = "a";
print_r($foo);
/* prints:
Array
(
[c] => c
[b] => b
[a] => a
)
*/
// likewise, for numerical indices:
$bar[2] = 2;
$bar[1] = 1;
$bar[0] = 0;
print_r($bar);
/* prints:
Array
(
[2] => 2
[1] => 1
[0] => 0
)
*/
/* If you are unsure of what the *internal* order
* of your array is, either use a for() loop, or
* use the array sorting functions.
*/
--
http://www.php.net/manual/en/language.types.array.php
http://master.php.net/manage/user-notes.php?action=edit+28526
http://master.php.net/manage/user-notes.php?action=delete+28526
http://master.php.net/manage/user-notes.php?action=reject+28526