Re: what to use instead of foreach

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Leon du Plessis wrote:
> Hi PJ,
>
> Maybe you should post your code, or portion thereof. The trained eyes on the
> list will quickly gather where the problem in the logic lies. 
>
> Maybe you can also sacrifice some of your data or data structures if not too
> sensitive. This will help to validate the route you are trying to follow.
>
> Best wishes
> Leon
>
> -----Original Message-----
> From: Jan G.B. [mailto:ro0ot.w00t@xxxxxxxxxxxxxx] 
> Sent: 14 April 2009 05:45 PM
> To: PJ
> Cc: Leon du Plessis; php-general@xxxxxxxxxxxxx
> Subject: Re:  what to use instead of foreach
>
> 2009/4/13 PJ <af.gourmet@xxxxxxxxxxxx>:
>   
>> I have already tried with several count and for schemes. None work
>> because foreach ignores any counters once in the loop. Also, this
>> foreach is nested within another foreach; don't know if that affects
>> anything.
>>     
>
>
> Have you heard of while()? You can use it in combination with
> array_pop() and count()
>
> like:
> <?
> while (($data = array_pop($array)) !== NULL) {
>     /* having $data and count($array) changes with every loop */
> }
> ?>
>
> Bye
>
>   
Good suggestion Leon, thanks.
I can certainly do that, np. Nothing sensitive. I do have quite a few
questions about the code I have used. Things are moving along very well
and I should be able to put up the code on the actual site in some
directory where it will be possible to view the code and see what it is
doing. I'll post the link when more or less ready and then ask for
comments, observations, suggestions . Posting the code on the list would
be too bumbersome. For now, I'll stick to some snippets. :-)

-- 
unheralded genius: "A clean desk is the sign of a dull mind. "
-------------------------------------------------------------
Phil Jourdan --- pj@xxxxxxxxxxxxx
   http://www.ptahhotep.com
   http://www.chiccantine.com/andypantry.php


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux