03-01-2009, 01:15 AM
|
#2 (permalink)
|
|
La Vida es Sueño
Join Date: Sep 2007
Location: Oldham
Posts: 2,280
Thanks: 90
|
This is because within the foreach loop you have moved the array pointer one place each time. After the foreach loop the pointer points to the very end of the array, and current will return NULL. However, if you reset the pointer of the array in between your loops as seen below, your second loop will loop correctly because the array pointer has been reset to the beginning.
This works like so because your second loop is not a foreach loop. A foreach automatically resets the array pointer before looping again.
__________________
The man who comes back through the Door in the Wall will never be quite the same as the man who went out.
|
|
|