Codes:
$a = array('email'=>'orange@test','topic'=>'welcome onboard','timestamp'=>'2017-10-6');
$b = array();
foreach($a as $v){
$b[] = &$v;
}
var_dump($a);
var_dump($b);
Result:
array(3) {
["email"]=>
string(11) "orange@test"
["topic"]=>
string(15) "welcome onboard"
["timestamp"]=>
string(9) "2017-10-6"
}
array(3) {
[0]=>
&string(9) "2017-10-6"
[1]=>
&string(9) "2017-10-6"
[2]=>
&string(9) "2017-10-6"
}
Why the content of $b is not reference of each element of $a? What I expected of $b should be like {&a[0],&a[1],&a[2]} instead of {&a[2],&a[2],&a[2]}