Challenge - 5 Problems
PHP Hello World Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ Predict Output
intermediate2:00remaining
What is the output of this PHP code?
Look at this PHP code. What will it print when run?
PHP
<?php echo "Hello World!"; ?>
Attempts:
2 left
💡 Hint
Remember PHP is case sensitive in strings and echo prints exactly what is inside quotes.
✗ Incorrect
The echo statement prints the exact string inside the quotes. So it prints Hello World! with capital H and W and a space.
❓ Predict Output
intermediate2:00remaining
What error does this PHP code produce?
This PHP code is missing something. What error will it cause?
PHP
<?php echo "Hello World!" ?>
Attempts:
2 left
💡 Hint
Check if all statements end properly in PHP.
✗ Incorrect
PHP requires a semicolon at the end of statements. Missing it causes a parse error.
🧠 Conceptual
advanced2:00remaining
Which PHP tag is correct to start PHP code?
You want to write PHP code inside an HTML file. Which tag correctly starts PHP code?
Attempts:
2 left
💡 Hint
PHP code always starts with a special opening tag.
✗ Incorrect
The correct opening tag for PHP code is
❓ Predict Output
advanced2:00remaining
What is the output of this PHP code?
What will this PHP code print?
PHP
<?php echo "Hello" . " " . "World!"; ?>
Attempts:
2 left
💡 Hint
The dot (.) operator joins strings in PHP.
✗ Incorrect
The dot operator concatenates strings. So it prints Hello, a space, then World! together.
❓ Predict Output
expert2:00remaining
What is the output of this PHP code with variables?
Look at this PHP code. What will it print?
PHP
<?php $greeting = "Hello"; $target = "World!"; echo "$greeting $target"; ?>
Attempts:
2 left
💡 Hint
Variables inside double quotes are replaced by their values in PHP.
✗ Incorrect
PHP replaces variables inside double quotes with their values, so it prints Hello World! with a space.