From: Paul M Foster on
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
From: Shreyas on
All,

I tried and tested it but wanted a solid confirmation on it. I felt foreach
usage is better than manual way of next(), prev() et al.

Thanks for the comments. I consider the thread answered and solved unless
someone has anything more to add.

Regards,
Shreyas

On Thu, Jun 10, 2010 at 7:02 PM, Paul M Foster <paulf(a)quillandmouse.com>wrote:

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


--
Regards,
Shreyas
From: tedd on
At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
>On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
>
> > 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:

Now, if I could get the old memory to "lock in" and remember it, it
would be great!

I spend much of my time thinking "Did I do that before?"

Cheers,

tedd
--
-------
http://sperling.com http://ancientstones.com http://earthstones.com
From: Paul M Foster on
On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:

> At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
>> On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
>>
>> > 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:
>
> Now, if I could get the old memory to "lock in" and remember it, it
> would be great!
>
> I spend much of my time thinking "Did I do that before?"

<grin> I know the feeling. I will say this, though. I have yet to figure
out, from your URLs, how your site(s) is/are organized. Maybe a reorg
would help?

Paul

--
Paul M. Foster
From: "Bob McConnell" on
From: Paul M Foster

> On Thu, Jun 10, 2010 at 11:16:08AM -0400, tedd wrote:
>
>> At 9:32 AM -0400 6/10/10, Paul M Foster wrote:
>>> On Thu, Jun 10, 2010 at 07:03:28AM -0400, tedd wrote:
>>>
>>
>> Paul:
>>
>> Now, if I could get the old memory to "lock in" and remember it, it
>> would be great!
>>
>> I spend much of my time thinking "Did I do that before?"
>
> <grin> I know the feeling. I will say this, though. I have yet to
figure
> out, from your URLs, how your site(s) is/are organized. Maybe a reorg
> would help?

ISTR there are three signs of old age. The first is loss of memory, but
I can never remember the other two.

Bob McConnell
First  |  Prev  |  Next  |  Last
Pages: 1 2 3
Prev: Passing large object between methods
Next: Redirect to