note 29045 modified in function.array-reverse by vrana
| From: | vrana@php.net | Date: | Tue, 17 Aug 2004 14:48:55 +0000 |
| Subject: | note 29045 modified in function.array-reverse by vrana | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-79750@lists.php.net to get a copy of this message | ||
If you want to reverse an array with numerical indexes, you can keep them by using following code:
<?php
end($gruppenarr);
do {
$part1=key($gruppenarr);
$part2=current($gruppenarr);
$gruppenarr2[$part1]=$part2;
} while(prev($gruppenarr));
?>
input is $gruppenarr
output is $gruppenarr2
--was--
If you want to reverse an array with numerical indexes, you can keep them by using following code:
end($gruppenarr);
do {
$part1=key($gruppenarr);
$part2=current($gruppenarr);
$gruppenarr2[$part1]=$part2;
} while(prev($gruppenarr));
input is $gruppenarr
output is $gruppenarr2
http://php.net/manual/en/function.array-reverse.php