note 20717 added to function.array-push
| From: | daniel at nomail dot com | Date: | Sat, 13 Apr 2002 23:17:16 +0000 |
| Subject: | note 20717 added to function.array-push | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-29241@lists.php.net to get a copy of this message | ||
If you want to use integer keys simply treat it as an 'ordinary' array.
$user_arr = array();
$user_id = 4;
$user_name = 'John';
$user_arr[$user_id] = $user_name;
$user_id = 346;
$user_name = 'Steve';
$user_arr[$user_id] = $user_name;
$user_id = 652;
$user_name = 'Maria';
$user_arr[$user_id] = $user_name;
All slots in between the three user IDs will not be allocated and sizeof($user_arr) will return 3
and not 653.
--
http://www.php.net/manual/en/function.array-push.php
http://master.php.net/manage/user-notes.php?action=edit+20717
http://master.php.net/manage/user-notes.php?action=delete+20717
http://master.php.net/manage/user-notes.php?action=reject+20717