4 ms·
> Including a function like count() or sizeof() within a loops execution condition is a bad idea. This expression will be executed with every iteration. I've b
by jbrooksuk 12y ago
> Including a function like count() or sizeof() within a loops execution condition is a bad idea. This expression will be executed with every iteration.
I've been told by numerous people that this is no longer the case, the value is cached.
- scintill76 12y agoYeah, that smells a bit like premature optimization. Anyway, I'd use foreach as much as possible, avoiding that issue as a side-effect.
- jbrooksuk 12y agoI completely agree. Foreach is generally nicer for looping a collection anyway.