NYCPHP Meetup

NYPHP.org

[nycphp-talk] string function

Urb LeJeune urb at e-government.com
Thu Jul 3 11:11:43 EDT 2008


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

Urb

>for($Sub1=0,$Sub2=1;$Sub2<=$Count;)
>{
>    echo "<br />$Parts[$Sub1] $Parts[Sub2]\n";
>    $Sub1+=2;
>    $Sub2+=2;
>}
>
>I just want to know if I read it correctly.
>
>Thanks,
>
>Nestor :-)
>
>On Thu, Jul 3, 2008 at 7:36 AM, Urb LeJeune 
><<mailto:urb at e-government.com>urb at e-government.com> wrote:
>
>An unknown string,its format is:
>y="tnk81|98.8$|yuhj78t|32.6$|tris78y|459.78$|....."
>
>
>list($Parts) = explode("|",$y);
>$Count = count($Parts);
>for($Sub1=0,$Sub2=1;$Sub2<=$Count;$Sub1++,$Sub1++,$Sub2++,$Sub2++)
>  echo "<br />$Parts[$Sub1] $Parts[Sub2]\n";

Urb

Dr. Urban A. LeJeune, President
E-Government.com
609-294-0320  800-204-9545
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
E-Government.com lowers you costs while increasing your expectations.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20080703/5d079de4/attachment.html>


More information about the talk mailing list