0
我有這段代碼但不起作用。我如何修改foreach循環內的數組?
$arr1 = array('test1', 'test2', 'test3');
$arr2 = array(1, 2, 3);
foreach ($arr1 as $x) {
$m = array_shift($arr2);
//at this point, $arr2 remains unchanged, why?
continue;
}
$ arr2在迭代內部和之間似乎沒有變化。任何見解將不勝感激。謝謝!
的[?改變foreach循環內的初始陣列]可能重複(http://stackoverflow.com/questions/2348077/change-initial -array-內最的foreach環) – VeeeneX 2015-02-08 12:12:24