reset()
After manipulating an array’s pointer (using next() or foreach() for example) use this function to set it back at the beginning. It will also return you the value of the first element.
$arr = array('apple', 'banana', 'carrot'); $one = next($arr); // banana $two = next($arr); // carrot $three = reset($arr); // apple foreach($arr as $food) { echo "I like $food sometimes\n"; } $four = current($arr); // false $five = reset($arr); // apple
See the manual entry for reset()
