note 74906 added to function.array-reverse
| From: | ChristianBartels at osu1 dot php dot net | Date: | Thu, 03 May 2007 14:32:04 +0000 |
| Subject: | note 74906 added to function.array-reverse | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-126146@lists.php.net to get a copy of this message | ||
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);
}
?>
----
Server IP: 212.124.37.9
Probable Submitter: 62.159.63.66
----
Manual Page -- http://www.php.net/manual/en/function.array-reverse.php
Edit -- https://master.php.net/note/edit/74906
Del: integrated -- https://master.php.net/note/delete/74906/integrated
Del: useless -- https://master.php.net/note/delete/74906/useless
Del: bad code -- https://master.php.net/note/delete/74906/bad+code
Del: spam -- https://master.php.net/note/delete/74906/spam
Del: non-english -- https://master.php.net/note/delete/74906/non-english
Del: in docs -- https://master.php.net/note/delete/74906/in+docs
Del: other reasons-- https://master.php.net/note/delete/74906
Reject -- https://master.php.net/note/reject/74906
Search -- https://master.php.net/manage/user-notes.php