Q. What will be the output?
Code:
$a = ['a'=>1, 'b'=>2];
foreach($a as $k => &$v) {}
$v = 5;
print_r($a);
β
Correct Answer: (B)
[1,5]
Explanation: Reference modifies last element.