The reset function points the internal pointer of the array to the first element and outputs the array.
Basic syntax
reset(array)
reset() rewinds the internal pointer of array to the first cell and returns the value of the first array cell.
Parameter introduction:
Return value
Returns the value of the first unit of the array, or FALSE if the array is empty.
Example
<?php $array = array('step one', 'step two', 'step three', 'step four'); // 数组默认指针指向第一个元素 echo current($array)."<br />"; // 将指针指向下一个元素 next($array); next($array); echo current($array)."<br />"; // 将指针指向重新指向第一个元素 reset($array); echo current($array)."<br />"; ?>
Running result:
step one
step three
step one