On Fri, Oct 28, 2011 at 14:18, Jim Long 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) {
>
On Fri, Oct 28, 2011 at 12:09:24PM -0600, George Langley wrote:
> Hi all. Am wondering if there is a best practice for looping through an
> array, when you need both the item and its position (ie. 1, 2, 3). The
> two ways I know of:
>
> // the for loop tracks the position and you get e
Hi all. Am wondering if there is a best practice for looping through an
array, when you need both the item and its position (ie. 1, 2, 3). The two
ways I know of:
// the for loop tracks the position and you get each item from the array
$allFiles = array("coffee.jpg", "tea.jpg
3 matches
Mail list logo