[nycphp-talk] string function
Michael Southwell
michael.southwell at nyphp.com
Thu Jul 3 12:45:07 EDT 2008
John Campbell wrote:
> $p = explode('|',$y);
> for($i=0,$c = count($p);$i<$c;) {
> echo $p[$i++],' ', $p[$i++], "<br>\n";
> }
I believe this will miss the first element of $p; you need instead:
for ( $i = -1, $c = count( $p ); $i < $c; ) {
--
=================
Michael Southwell
Vice President, Education
NYPHP TRAINING: http://nyphp.com/Training/Indepth
More information about the talk
mailing list