昨天在做数据库批量导入的时候遇到的老问题(foreach+&问题)
问题可以简要的概括为:
$arr = array(1,2,3,4,5);
foreach($arr as $key => &$row) {}
foreach($arr as $key => $row) {}
var_dump($arr);
array (size=5)
0 => int 1
1 => int 2
2 => int 3
3 => int 4
4 => &int 4
$arr = array(1,2,3,4,5);
foreach($arr as $key => &$row) {}
var_dump($arr);
echo $arr[4].'<br/>';
foreach($arr as $key => $row) {
echo $arr[4].'_';
}
var_dump($arr);