← All tasks
🔍
Programming Advanced

Fix a Stale Reference After foreach

⏱ 5 min ⭐ 120 XP 🔁 3 attempts allowed

What you'll do

Find the line missing an unset() that causes a later foreach to silently corrupt array data.

Scenario

After doubling every value in $prices with a by-reference foreach, a second unrelated foreach over $prices ends up overwriting the last element.

Ready to try it?

Create a free account and try "Fix a Stale Reference After foreach" free for 7 days, no card required. Earn 120 XP and track your internship progress.

Already have an account? Sign in