Challenge - 5 Problems
Echo 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 echo statement?
Consider the following PHP code snippet. What will it print?
PHP
<?php echo "Hello " . "World!"; ?>
Attempts:
2 left
💡 Hint
The dot (.) operator in PHP joins strings together.
✗ Incorrect
The dot operator concatenates strings in PHP. So "Hello " . "World!" becomes "Hello World!".
❓ Predict Output
intermediate2:00remaining
What does this echo statement output?
Look at this PHP code. What will be printed?
PHP
<?php echo 5 + 3; ?>
Attempts:
2 left
💡 Hint
PHP evaluates expressions inside echo before printing.
✗ Incorrect
The expression 5 + 3 is calculated to 8, which is then printed.
❓ Predict Output
advanced2:00remaining
What is the output of this PHP echo with variables?
Given the code below, what will echo print?
PHP
<?php $name = "Alice"; echo "Hello, $name!"; ?>
Attempts:
2 left
💡 Hint
Double quotes allow variable interpolation in PHP.
✗ Incorrect
Inside double quotes, PHP replaces $name with its value, so it prints Hello, Alice!
❓ Predict Output
advanced2:00remaining
What error does this PHP echo statement cause?
What error will this PHP code produce?
PHP
<?php echo 'Hello, $name!'; ?>
Attempts:
2 left
💡 Hint
Single quotes do not replace variables in PHP strings.
✗ Incorrect
Single quotes print the string as is, so $name is not replaced and prints literally.
🧠 Conceptual
expert2:00remaining
How many items are printed by this PHP echo statement?
What is the number of separate items printed by this echo statement?
PHP
<?php echo "Hi", " there", "!"; ?>
Attempts:
2 left
💡 Hint
Echo can take multiple comma-separated arguments.
✗ Incorrect
Echo can print multiple strings separated by commas, so it prints 3 items.