Q. What will be the output?
Code:
$a = [1,2,3];
foreach($a as $k => &$v) {}
$v = 10;
print_r($a);
β
Correct Answer: (B)
[1,2,10]
Explanation: Reference persists after loop, modifying last element.