超越PHP PHP动态 | 经典文章 | CLASS | 相关下载 | 常见问题 | FORUM | WIKI | 在线手册
Site search:    
<rangersort>
Last updated: Fri, 22 Jun 2007

reset

(PHP 3, PHP 4 , PHP 5)

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

说明

mixed reset ( array array)

reset()array 的内部指针倒回到第一个单元并返回第一个数组单元的值。

参见 current()each()next()prev()




add a note add a note User Contributed Notes
reset
kk at shonline dot de
30-Jul-1998 08:22
When used on a scalar or unset value, reset() spews warning messages. This is often a problem when accessing arrays generated from HTML form input data: these are scalar or unset if the user didn't enter sufficient information.

You can silence these error messages by prefixing an @ (at sign) to reset(), but it is better style to protect your reset() and the following array traversal with an if (isset()). Example code:

if (isset($form_array)) {
 reset($form_array);
while (list($k, $v) = each($form_array) {
   do_something($k, $v);
 }
}

<rangersort>
 Last updated: Fri, 22 Jun 2007
view source | feedback | send page | sitemap | aboutus   
Copyright ® 2002-2003 PHPE.NET. All rights reserved
Last updated:2002-11-22