Hello,
I am using foreach to move through an array. I want to treat the last item differently than all the preceding ones. How do I determine when I've reached the the last spot?
Thanks!
Determine when pointer has reached end of array?
Moderator: General Moderators
- ambivalent
- Forum Contributor
- Posts: 173
- Joined: Thu Apr 14, 2005 8:58 pm
- Location: Toronto, ON
count the array elements, then decrement as you loop through it.
Determine when pointer has reached end of array?
Thank you. This did exactly what I needed it to.