note 18623 added to function.array-values
| From: | carl at php2 dot chek dot com | Date: | Tue, 29 Jan 2002 20:59:22 +0000 |
| Subject: | note 18623 added to function.array-values | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-25985@lists.php.net to get a copy of this message | ||
Indeed you can, and that's what's so great about it. I have, for instance, a function that
returns the results of a database query as an array. I want to keep the order that the entries were
returned in, but at the same time I want to be able to access them _either_ by the position _or_ by
some other index (such as some sort of ID in the database, gotten from elsewhere). In this case, I
can make the function return an array from id to [array of values], and by a simple call to
array_values() this is transformed into an array indexed from 0 to count()-1. Useful.
--
http://www.php.net/manual/en/function.array-values.php
http://master.php.net/manage/user-notes.php?action=edit+18623
http://master.php.net/manage/user-notes.php?action=delete+18623
http://master.php.net/manage/user-notes.php?action=reject+18623