reset

(PHP 3, PHP 4, PHP 5)

reset --  將陣列的內定指標指向第一個單元

說明

mixed reset ( array &array )

reset()array 的內定指標倒回到第一個單元並返回第一個陣列單元的值,若果陣列為空則返回 FALSE

例子 1. reset() 例子

<?php

$array 
= array('step one''step two''step three''step four');

// by default, the pointer is on the first element
echo current($array) . "<br />\n"// "step one"

// skip two steps
next($array);
next($array);
echo 
current($array) . "<br />\n"// "step three"

// reset pointer, start again on step one
reset($array);
echo 
current($array) . "<br />\n"// "step one"

?>

參見 current()each()next()prev()