On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:

> At 7:19 AM +0530 6/10/10, Shreyas wrote:
>> PHP'ers,
>>
>> I am reading a PHP book which explains foreach and at the end says : *'When
>> foreach starts walking through an array, it moves the pointer to
>> the beginning of the array. You don't need to reset an array before
>> walking through it with foreach.'*
>> *
>> *
>> *Does this mean - *
>> *1) Before I navigate the array, foreach will bring the pointer to the
>> starting key?*
>> *2) After the first index, it goes to 2nd, 3rd, and nth? *
>>
>>
>> Regards,
>> Shreyas
>
> Shreyas:
>
> This is one of those questions that you can test very easily, just
> initialize an array and try it.

+1

This is Tedd's modus operandi. His website(s) are full of exactly this
type of thing. And I have to agree. I can't count the number of
questions I *haven't* asked on this list, because I built a page to test
a particular concept. And this sort of activity (as opposed to just
reading about something) really locks in your understanding of a
concept.

Paul

-- 
Paul M. Foster

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

Reply via email to