PHP: 5.2.10-2ubuntu6.3 (default apt-get installation on actual, see Date, jaunty 9.10 Ubuntu Distro - G33kWoRDs)
Have a look at your array pointer if you copy an array - the pointer will be copied, too.
For example if you got this construct:
<?php
$array = array('zero','one','two','three','four','five','six','seven');
$array2 = $array;
next($array);
echo key($array);
echo key($array2);
?>
But if you copy the array after you've setted the pointer, the pointer will be copied, too:
<?php
$array = array('zero','one','two','three','four','five','six','seven');
next($array);
$array2 = $array;
echo key($array);
echo key($array2);
?>
What's more is, that foreach not resetting the pointer after walk through:
<?php
$array = array('zero','one','two','three','four','five','six','seven');
next($array);
$array2 = array();
foreach($array AS $key => $value){
echo $key;
$array2[$key] = $value;
}
echo var_dump(key($array));
echo key($array2);
?>
The php-functions seems to reset the pointer on the given position after walk through (i don't know the internal handling - there could be used a copy of the array, too):
<?php
$array = array('zero','one','two','three','four','five','six','seven');
next($array);
$array2 = array_values($array);
echo key($array);
echo key($array2);
?>
There are a lot Methods like array_merge($array) that will neither reset the pointer of $array nor copy the pointer to $array2. Have a look on this.
I Hope this was a little helpfull.