Home >Backend Development >PHP Tutorial > 数组的指针有关问题

数组的指针有关问题

WBOY
WBOYOriginal
2016-06-13 12:36:47763browse

数组的指针问题

<br />
<?php<br />
<br />
$arr = array(<br />
	array(<br />
		'id'=>1,<br />
		'title'=>'测试1',<br />
	),<br />
	array(<br />
		'id'=>2,<br />
		'title'=>'测试2',<br />
	),<br />
	array(<br />
		'id'=>3,<br />
		'title'=>'测试3',<br />
	),<br />
	array(<br />
		'id'=>4,<br />
		'title'=>'测试4',<br />
	),<br />
	array(<br />
		'id'=>5,<br />
		'title'=>'测试5',<br />
	),<br />
);<br />
<br />
while(list($k, $v) = each($arr)){<br />
<br />
	print_r(current($arr));<br />
<br />
	echo '<br>';<br />
<br />
}<br />
<br />


循环一个二维数组,使用 current 返回当前元素,为啥从第2个元素开始的呢? 想要从1开始怎么做,请前辈指教

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn