note 88632 deleted from function.array-reverse by danbrown
| From: | danbrown@php.net | Date: | Sun, 01 Feb 2009 20:10:27 +0000 |
| Subject: | note 88632 deleted from function.array-reverse by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-150075@lists.php.net to get a copy of this message | ||
Note Submitter: soupar
----
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);
}
?>