Re: BP for Looping through an Array

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

 



On Fri, Oct 28, 2011 at 14:18, Jim Long <php@xxxxxxxxxxxxx> wrote:
>
> If you are certain that your array is consecutively indexed from
> 0, you can shave two lines off your code with:
>
>        $allFiles = array("coffee.jpg", "tea.jpg", "milk.jpg");
>        foreach ($allFiles as $key => $currFile) {
>                doThisWith($currFile);
>                doThatWith($key+1);
>        }

    See also: http://php.net/array_walk

-- 
</Daniel P. Brown>
Network Infrastructure Manager
http://www.php.net/

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