note 88631 deleted from function.array-reverse by salathe
| From: | salathe@php.net | Date: | Fri, 08 Jun 2012 20:07:29 +0000 |
| Subject: | note 88631 deleted from function.array-reverse by salathe | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-188501@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Reversing array by reference (does not preserve keys!):
<?php
function arrayReverse(&$arr)
{
$c = count($arr);
for($i=$c-1;$i>=0;$i--)
{
$arr[$c+$i] = $arr[$i];
}
$arr = array_slice($arr,$c,$c*2);
}
?>