My script is:
$arr=array('A','B');
foreach($arr as &$val){
$val=str_replace(array('B'),array('C'),substr($val,0,1));
}
print_r($arr);
foreach($arr as $key=>$val)echo $key.'=>'.$val.'|||||';
echo phpversion();
When i run it responce look like below:
Array
(
[0] => A
[1] => C
)
0=>A|||||1=>A|||||5.6.16
I think responce must be as 0=>A|||||1=>C||||| but it is not. I can't find reason. Is this a PHP bug or is my script needs a fix?