PHP Exercises
Each PHP lesson has a fill-in-the-blank exercise. Complete a short snippet with one or two missing tokens — the grader checks your answer against the expected result.
How it works
- Read the instruction at the top.
- Click the blank, type your answer, press Run.
- A wrong answer triggers a hint; the second wrong try reveals the solution.
Why fill-in-the-blank
| Format | What it tests |
|---|---|
| Multi-choice quiz | Recognition — "I've seen this." |
| Fill-in-the-blank | Recall — "I can produce this." |
| Open-ended | Synthesis — "I can build this from scratch." |
Recall is the strongest predictor of retention. Blanks are kept small so cognitive load stays on the new concept.
Sample
PHP
// Instruction: echo "Hello, world!" ____ "Hello, world!";
Answer: echo.
Where to go next
- Finish all 80+ PHP exercises to unlock the "Built it from blanks" badge.
- Try the 30-day bootcamp for daily challenges.
- Pair every exercise with a Try it Yourself » in the editor — vary the snippet to build intuition.
Tip: If a blank stumps you, scroll up — the lesson's example almost always demonstrates the answer.
Example
Example
<?php
// Fill-in-the-blank — complete the missing piece:
function greet($name) {
return 'Hello, ' . $name;
}
echo greet('Ada');
Try it Yourself »
Exercise
Exercise format.
fill-in-the-
Five letters.
Discussion
Loading…