note 74906 deleted from function.array-reverse by tularis
| From: | tularis@php.net | Date: | Thu, 03 May 2007 15:49:45 +0000 |
| Subject: | note 74906 deleted from function.array-reverse by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-126150@lists.php.net to get a copy of this message | ||
Note Submitter: Christian Bartels
Reason: bad code
----
With this function you can - similar to rahulavhad at yahoo dot com's solution - easily reverse
multidimensional arrays. It calls itself recursively to reverse any array within the array.
<?php
function array_multireverse($array) {
$array=array_reverse($array);
foreach($array as $key=>$value) {
if(is_array($value)) {
$array[$key]=array_multireverse($value);
}
}
return($array);
}
?>