0
0
PHPprogramming~10 mins

First PHP program (Hello World) - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to print 'Hello World' in PHP.

PHP
<?php
[1] "Hello World";
?>
Drag options to blanks, or click blank then click option'
Awrite
Bprint
Cshow
Decho
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'write' or 'show' which are not PHP commands.
Forgetting the semicolon at the end.
2fill in blank
medium

Complete the code to correctly start a PHP script.

PHP
[1]
// This is a PHP script
?>
Drag options to blanks, or click blank then click option'
A<?php
B<php>
C<script php>
D<?
Attempts:
3 left
💡 Hint
Common Mistakes
Using short tags like '
Using HTML script tags instead.
3fill in blank
hard

Fix the error in the code to correctly print 'Hello World'.

PHP
<?php
echo [1]Hello World[2];
?>
Drag options to blanks, or click blank then click option'
A'
C`
D"
Attempts:
3 left
💡 Hint
Common Mistakes
Leaving out quotes causes syntax errors.
Using backticks which are for shell commands.
4fill in blank
hard

Fill both blanks to create a PHP script that prints 'Hello World' and ends correctly.

PHP
[1]
echo "Hello World";[2]
Drag options to blanks, or click blank then click option'
A<?php
B?>
C;
D//
Attempts:
3 left
💡 Hint
Common Mistakes
Forgetting the closing tag.
Using comments instead of closing tag.
5fill in blank
hard

Fill all three blanks to create a PHP script that prints 'Hello World' with correct syntax.

PHP
[1]
echo [2]Hello World[3];
Drag options to blanks, or click blank then click option'
A<?php
B"
D'
Attempts:
3 left
💡 Hint
Common Mistakes
Using mismatched quotes.
Forgetting the opening tag.