note 10374 added to array_reverse

From: Date: Sat, 30 Dec 2000 01:31:09 +0000
Subject: note 10374 added to array_reverse
Groups: php.notes 
Request: Send a blank email to php-notes+get-9261@lists.php.net to get a copy of this message
This code can help in recursive reversing of the array... $arr1 = array(2,1,array(5,2,1,array(9,8,7)),5,0); $arr1 = array_reverse($arr1); function Reverse_Array($array) { $index = 0; foreach ($array as $subarray) { if (is_array($subarray)) { $subarray = array_reverse($subarray); $arr = Reverse_Array($subarray); $array[$index] = $arr; } else {$array[$index] = $subarray;} $index++; } return $array; } $arr2 = Reverse_Array($arr1); http://www.php.net/manual/function.array-reverse.php

« previous php.notes (#9261) next »