Re: what to use instead of foreach

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

 



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

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