一、reset将数组的内部指针指向第一个单元

mixed reset ( array &$array )

reset()array 的内部指针倒回到第一个单元并返回第一个数组单元的值,如果数组为空则返回 FALSE

Example #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"

?>

 

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-12-21
  • 2021-10-07
  • 2022-02-17
  • 2022-02-26
猜你喜欢
  • 2022-12-23
  • 2021-11-30
  • 2021-06-01
  • 2021-07-29
相关资源
相似解决方案