Actually, my 'don't know' was more like 'does anyone know?' .
But I figured I could find that out for myself.
Wrote a small script that creates an array (numeric indexed range) of
Then it calls array_reverse() on it 100 times.
This took a little more than 3 secs. on a P3, which is relatively slow IMO.
Ofcourse two calls won't really hurt if you have a fast server.
A larger array of 100,000 elements took more then 30 secs. (hit the timelimit) ..
So the speed is clearly affected by the size of the array, *maybe* even by the size of
the elements ..
Here's the code I used to test:
$arr = range(1, 10000);
for ($i = 0; $i < 100; $i++)
echo(get_clock() . "\n");
// timer functions
$start = microtime();
$stop = microtime();
$start = split(" ", $start);
$stop = split(" ", $stop);
$start = (float)$start + $start;
$stop = (float)$stop + $stop;
$time = $stop - $start;
$htime = (int)($time / 3600);
$time -= ($htime * 3600);
$mtime = (int)($time / 60);
$time -= ($mtime * 60);
$stime = ((int)($time * 100) / 100);
$stime = ereg_replace("\.", "s", $stime);
$clock = $htime . "H";
$clock .= $mtime . "m";
return $clock . $stime . "h";
On Thu, 10 Jan 2002 05:54:49 -0500, Gerard Samuel wrote:
>Thats my biggest concern now, performance with whatever alternatives
>that can be dreamed up...
>Anyway, its 6 in the morning, time for sleep. Maybe Ill dream up
>[EMAIL PROTECTED] wrote:
>> You are right, I should've known (used it before) ..
>> Ofcourse you could do an array_reverse() before and after,
>> don't know about the performance impact of that however.
>>>array_pop() and array_shift are *different* :)
>>>array_pop() takes an element off the END of the array.
>>>array_shift() takes an element off the START of the array.
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]