On Thu, Jul 3, 2008 at 11:11 AM, Urb LeJeune <[EMAIL PROTECTED]> wrote: > Is this the same thing that you are trying to accomplish with the > for loop? > > Yes but increments (or decrements) are executed much more efficiently than > additions.
This is wrong for three reasons: 1) 4 ++ increments is 2.5x slower than one increment by two. 2) Unless you are using an opcode cache, any gains from faster execution are probably lost by the additional parsing required. Of course this depends of the number of elements in the loop. 3) Unreadable code is orders of magnitude more expensive than the performance benefit. Ignoring #3, the fastest way to write it is something like: $p = explode('|',$y); for($i=0,$c = count($p);$i<$c;) { echo $p[$i++],' ', $p[$i++], "<br>\n"; } Removing the string concatenation is more beneficial than any increment / decrement hacking. Regards, John C. _______________________________________________ New York PHP Community Talk Mailing List http://lists.nyphp.org/mailman/listinfo/talk NYPHPCon 2006 Presentations Online http://www.nyphpcon.com Show Your Participation in New York PHP http://www.nyphp.org/show_participation.php