← All tasks
🧮
Programming Intermediate

Write a Closure That Captures an Outer Variable by Reference

⏱ 3 min ⭐ 90 XP 🔁 3 attempts allowed

What you'll do

Write the PHP closure expression that increments an outer $total variable each time it's called, using use (&...).

Scenario

You're building a running total callback passed into array_walk.

Ready to try it?

Create a free account and try "Write a Closure That Captures an Outer Variable by Reference" free for 7 days, no card required. Earn 90 XP and track your internship progress.

Already have an account? Sign in