← All tasks
🧮
Programming Advanced

Write a Generator Function Using yield

⏱ 3 min ⭐ 90 XP 🔁 3 attempts allowed

What you'll do

Write the PHP generator function readLines($path) that yields each line of a file one at a time instead of returning a full array.

Scenario

You're processing a huge log file and want to avoid loading it entirely into memory.

Ready to try it?

Create a free account and try "Write a Generator Function Using yield" free for 7 days, no card required. Earn 90 XP and track your internship progress.

Already have an account? Sign in