Thanks for your tip, but unfortunately it wouldn´t help me.

""Richard Lynch"" <[EMAIL PROTECTED]> escreveu na mensagem 
news:[EMAIL PROTECTED]
> On Tue, October 10, 2006 1:14 pm, João Cândido de Souza Neto wrote:
>> $numbers=array(1,2,3,4,5);
>> foreach ($numbers as number) {
>>     ...
>> }
>>
>> Inside foreach, could i know if i am in the last element of the array
>> $numbers?
>
> In general, you can't.
>
> If the elements are unique, you could do:
>
> $last = end($numbers);
>   ...
>   if ($last == $number) "this is the end";
>
> Most people who want this "feature" are trying to suppress outputting
> a comma or other separator after the last item because they have not
> yet figured out how to use this function:
> http://php.net/implode
>
> -- 
> Some people have a "gift" link here.
> Know what I want?
> I want you to buy a CD from some starving artist.
> http://cdbaby.com/browse/from/lynch
> Yeah, I get a buck. So? 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to