Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread [EMAIL PROTECTED]


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
10,000 elements.

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:




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 
>something else
>
>[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.
>> 
>> bvr.
>> 
>> 
>>>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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread Jason Wong

On Thursday 10 January 2002 18:54, [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* :)


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
When the blind lead the blind they will both fall over the cliff.
-- Chinese proverb
*/

-- 
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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread Gerard Samuel

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 
something else

[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.
> 
> bvr.
> 
> 
>>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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread [EMAIL PROTECTED]



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.

bvr.

>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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread Gerard Samuel

Yeah its 4.0.4.  I figure it strange also since array_shift was there 
since 4.0.0.
array_pop(), isn't that for the last element.  I want to take out the 
first element, thus array_shift.
Ill try the regexp and see how it goes...
Ill report back
Thanks

[EMAIL PROTECTED] wrote:

> Strange, are you sure it's 4.0.4 ??
> 
> The manual for array_shift() says it's supported from 4.0.0 .
> 
> Maybe try the alias array_pop() ?
> 
> otherwise there'll be other ways to strip the first part of the directory,
> for example using regexp, try something like:
> 
>ereg("^[^/]/(.*)$", dirname($PHP_SELF), $regs);
>   $c = explode("/", $regs[1]);
> ?>
> 
> 
> On Wed, 09 Jan 2002 22:00:49 -0500, Gerard Samuel wrote:
> 
> 
>>Hey all.  Im putting together a script and Im having a couple people 
>>test it out.
>>
>>Here is a bit of code...
>>
>>$c = explode ('/', dirname($PHP_SELF));
>>array_shift($c);
>>
>>It runs fine on my box, php 4.0.6, apache 1.3.22.
>>
>>On a box with php 4.0.4pl1, apache 1.3.20 it spits an error.
>>Fatal error: Call to unsupported or undefined function array_shift() in 
>>file.php on line 15
>>
>>Where/Is there anything wrong with 4.0.4??
>>
>>
>>
>>-- 
>>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]
>>
>>
>>
> 
> 
> 
> 



-- 
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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread Jason Wong

On Thursday 10 January 2002 17:38, [EMAIL PROTECTED] wrote:
> Strange, are you sure it's 4.0.4 ??
>
> The manual for array_shift() says it's supported from 4.0.0 .
>
> Maybe try the alias array_pop() ?

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.


-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk

/*
Never pay a compliment as if expecting a receipt.
*/

-- 
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]




Re: [PHP] array_shift and php 4.0.4

2002-01-10 Thread [EMAIL PROTECTED]


Strange, are you sure it's 4.0.4 ??

The manual for array_shift() says it's supported from 4.0.0 .

Maybe try the alias array_pop() ?

otherwise there'll be other ways to strip the first part of the directory,
for example using regexp, try something like:




On Wed, 09 Jan 2002 22:00:49 -0500, Gerard Samuel wrote:

>Hey all.  Im putting together a script and Im having a couple people 
>test it out.
>
>Here is a bit of code...
>
>$c = explode ('/', dirname($PHP_SELF));
>array_shift($c);
>
>It runs fine on my box, php 4.0.6, apache 1.3.22.
>
>On a box with php 4.0.4pl1, apache 1.3.20 it spits an error.
>Fatal error: Call to unsupported or undefined function array_shift() in 
>file.php on line 15
>
>Where/Is there anything wrong with 4.0.4??
>
>
>
>-- 
>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]
>
>




-- 
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]




[PHP] array_shift and php 4.0.4

2002-01-09 Thread Gerard Samuel

Hey all.  Im putting together a script and Im having a couple people 
test it out.

Here is a bit of code...

$c = explode ('/', dirname($PHP_SELF));
array_shift($c);

It runs fine on my box, php 4.0.6, apache 1.3.22.

On a box with php 4.0.4pl1, apache 1.3.20 it spits an error.
Fatal error: Call to unsupported or undefined function array_shift() in 
file.php on line 15

Where/Is there anything wrong with 4.0.4??



-- 
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]