this code produce an unexpected output:
$array=str_split("abcde");
foreach($array as &$item)
echo $item;
echo "\n";
foreach($array as $item)
echo $item;
output:
abcde
abcdd
if use &$item
for second loop everything works fine.
I don't understand how this code would affect the content of $array
. I could consider that an implicit unset($header)
would delete the last row but where does the double dd
comes from ?