Pick the correct explanation of a bug caused by reusing a loop variable after a by-reference foreach.
Scenario
foreach ($arr as &$val) { $val *= 2; } unset($val); is followed by a second foreach ($arr as $val) { ... } that behaves unexpectedly if unset($val) is omitted.
Ready to try it?
Create a free account and try "foreach by Reference Pitfall" free for 7 days, no card required. Earn 70 XP and track your internship progress.