Solved

Array Pointer

Posted on 2004-09-18
2
178 Views
Last Modified: 2009-07-29
//from php.net
Remember that print_r() will move the array pointer to the end. Use reset() to bring it back to beginning.

I was wondering what it means by the array pointer being at the end?  why is this bad?


Thanks!,

Chilled
0
Comment
Question by:chilled2003
2 Comments
 
LVL 36

Accepted Solution

by:
Zyloch earned 50 total points
ID: 12090812
Hi chilled2003,

Sometimes, you'll have to loop through an array and need the array pointer at the beginning. A classic example is when you're using next() or current(), for example, take this:

$testArray = array("dog","cat","eagle");
echo current($testArray);   //echos "dog"
echo next($testArray);      //echos "eagle"
reset($testArray);
echo current($testArray);   //echos "dog" again


You get the gist.

Regards,
Zyloch
0
 

Author Comment

by:chilled2003
ID: 12090821
I see now.  Thanks! :D
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now