reset
mixed reset(array array)
Moves the internal array pointer to the first element of the array and returns that element's value.
Returns:
Value of the first element of the array; FALSE if there is no first element
Description:
This function resets the internal array pointer to the first element of array
and returns the value of that element. The order in which PHP keeps the array is the same order in which the elements were put into the array by the use of any of the element-addition functions such as array(), push(), and so on.
Version:
PHP 3, PHP 4
See also:
end()
key()
current()
next()
prev()
Example:
Reset the internal array pointer
$my_array = array('a', 'b', 'c', 'd', 'e');
echo current($my_array);
for ($i = count($my_array); $i >= 0; $i--) {
echo "\n";
echo next($my_array);
}
echo reset($my_array); /* Now go back to the beginning. */
Output:
a
b
c
d
e
a
|