foreach 循环语句

 
 
foreach($array as $value)
只能用于循环遍历数组,每进行一次循环,当前数组元素就会赋值给$value
 
foreach($array as $key=>$value) 
 
能用于循环遍历数组,每进行一次循环,当前数组元素就会赋值给$value  当前每个单元的健名也给$key
Advertisements
此条目发表在PHP分类目录。将固定链接加入收藏夹。

发表评论

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / 更改 )

Twitter picture

You are commenting using your Twitter account. Log Out / 更改 )

Facebook photo

You are commenting using your Facebook account. Log Out / 更改 )

Google+ photo

You are commenting using your Google+ account. Log Out / 更改 )

Connecting to %s