1--TEST-- 2array_shift() function precerve foreach by reference iterator pointer 3--FILE-- 4<?php 5$a = [1,2,3,4]; 6foreach($a as &$v) { 7 echo "$v\n"; 8 array_shift($a); 9} 10var_dump($a); 11?> 12--EXPECT-- 131 142 153 164 17array(0) { 18} 19