Practice - 5 Tasks
Answer the questions below
1fill in blank
easyComplete the code to print a new line using an escape sequence.
PHP
<?php echo "Hello[1]World!"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using \t which adds a tab space instead of a new line.
Using \\ which prints a backslash.
✗ Incorrect
The escape sequence \n creates a new line in the output.
2fill in blank
mediumComplete the code to include a tab space between words.
PHP
<?php echo "Hello[1]World!"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using \n which adds a new line instead of a tab.
Using \\ which prints a backslash.
✗ Incorrect
The escape sequence \t adds a horizontal tab space between words.
3fill in blank
hardFix the error in the code to correctly print a backslash character.
PHP
<?php echo "This is a backslash: [1]"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using a single backslash which causes an error or unexpected output.
Using \n or \t which print new line or tab instead.
✗ Incorrect
To print a single backslash, you need to escape it with another backslash: \\.
4fill in blank
hardFill both blanks to print a double quote inside a string.
PHP
<?php echo "She said: [1]Hello[2]"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using unescaped double quotes which break the string.
Using single quotes which do not work inside double-quoted strings.
✗ Incorrect
To print double quotes inside a double-quoted string, use the escape sequence \".
5fill in blank
hardFill all three blanks to print a path with backslashes and a new line.
PHP
<?php echo "C:[1]Users[2]Documents[3]"; ?>
Drag options to blanks, or click blank then click option'
Attempts:
3 left
💡 Hint
Common Mistakes
Using single backslashes which cause errors.
Using forward slashes instead of backslashes.
Forgetting to add a new line escape sequence.
✗ Incorrect
Backslashes in paths must be escaped as \\. To add a new line, use \n.