re-ordering keys in an array
| From: | David T-G | Date: | Tue, 21 Jan 2003 13:51:48 +0000 |
| Subject: | re-ordering keys in an array | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-132399@lists.php.net to get a copy of this message | ||
Hi, all --
If I have an associative array $a like
Array
(
[t] => temp1
[u] => ugh
[m] => moo
)
is there any way to re-order the keys so that
foreach (array_keys($a) as $k)
{ print "$k\n" ; }
will print
t
m
u
for me? At the moment it seems my only option is
sort(array_keys($a))
and that's a start but finding another order spec would be lovely...
TIA & HAND
:-D
--
David T-G * There is too much animal courage in
(play) davidtg@justpickone.org * society and not sufficient moral courage.
(work) davidtgwork@justpickone.org -- Mary Baker Eddy, "Science and Health"
http://justpickone.org/davidtg/ Shpx gur
Pbzzhavpngvbaf Qrprapl Npg!