Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print the word Hello.
PHP
<?php [1] "Hello"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' or 'show' which are not PHP commands.
Forgetting to add a semicolon at the end.
✗ Incorrect
The echo statement is used in PHP to output text to the screen.
2fill in blank
mediumComplete the code to print the number 123.
PHP
<?php [1] 123; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' or 'show' which are not valid PHP commands.
Trying to use parentheses like a function.
✗ Incorrect
echo can output numbers directly in PHP.
3fill in blank
hardFix the error in the code to correctly print Hello World.
PHP
<?php [1] "Hello World"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Adding parentheses after echo which is not a function.
Forgetting the semicolon at the end.
✗ Incorrect
The echo statement must be followed by the text and a semicolon at the end of the line.
4fill in blank
hardFill both blanks to print the phrase Hello PHP.
PHP
<?php [1] [2]; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using print with double quotes but forgetting the semicolon.
Using single quotes when double quotes are expected.
✗ Incorrect
echo followed by a string in double quotes prints the phrase.
5fill in blank
hardFill both blanks to print the sentence Hello, PHP learner!
PHP
<?php [1] [2] ; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the semicolon at the end.
Using print without semicolon.
✗ Incorrect
The echo statement followed by the string and a semicolon prints the sentence.