NYCPHP Meetup

NYPHP.org

[nycphp-talk] string function

Brian O'Connor gatzby3jr at gmail.com
Thu Jul 3 13:42:16 EDT 2008


No.  $i++ returns the value of $i, then increments it.

On Thu, Jul 3, 2008 at 12:45 PM, Michael Southwell <
michael.southwell at nyphp.com> wrote:

> 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
>
> _______________________________________________
> 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
>



-- 
Brian O'Connor
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080703/dbea06ba/attachment.html>


More information about the talk mailing list