Example 1 — Go Back to the First Element
After moving the pointer forward, reset() brings it back to the start.
<?php
$letters = ["a", "b", "c"];
next($letters);
next($letters);
echo current($letters), PHP_EOL;
echo reset($letters), PHP_EOL; How It Works
- The two next() calls move the pointer to the third element.
- current() reads that element, so "c" is printed.
- reset() moves the pointer back to the first element.
- reset() returns the first value, "a", and echo prints it.

