On Tue, 7 Sep 2004, Mehdi Achour wrote:

> Derick Rethans wrote:
>
> >On Tue, 7 Sep 2004, Mehdi Achour wrote:
> >
> >
> >
> >>Isn't like count() ? someone told me that it was better to store the
> >>count in a variable and use it in the foreach to avoid calling it in
> >>every loop. If I'm wrong, feel free to revert my commit !
> >
> >No, you should revert it yourself. It doesn't make sense to use this in
> >a for() loop, but for foreach it makes no bloody sense to use a temp
> >variable.
>
> So, using count() in a for is bad, but okay in a foreach ?

Correct. Why wouldn't it be okay with a foreach()? It's only executed
once there.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

Reply via email to