Recall & Review
beginner
What is the purpose of the <?php ... ?> tags in a PHP file?
These tags tell the server to start and stop interpreting the code as PHP. Anything inside runs as PHP code.
Click to reveal answer
beginner
Write the PHP code to print 'Hello World' on the screen.
<?php<br>echo "Hello World";<br>?>
Click to reveal answer
beginner
What does the echo statement do in PHP?
It outputs text or variables to the web page or console.
Click to reveal answer
beginner
Can you run PHP code directly in a browser without a server?
No, PHP code runs on a server. The server processes PHP and sends HTML to the browser.
Click to reveal answer
beginner
What will happen if you forget the semicolon at the end of a PHP statement?
PHP will give a syntax error because semicolons mark the end of statements.
Click to reveal answer
Which tag starts PHP code in a file?
✗ Incorrect
The correct tag to start PHP code is <?php.
What does the echo statement do?
✗ Incorrect
Echo outputs text or variables to the screen.
What symbol ends a PHP statement?
✗ Incorrect
Semicolon (;) ends a PHP statement.
Can PHP code run directly in a browser without a server?
✗ Incorrect
PHP needs a server to run; browsers only display the output.
What will this code output? <?php echo "Hello World"; ?>
✗ Incorrect
The echo statement prints Hello World to the screen.
Explain how to write and run a simple PHP program that prints 'Hello World'.
Think about the tags, output command, and environment needed.
You got /4 concepts.
What are common mistakes beginners make when writing their first PHP program?
Consider syntax and environment errors.
You got /4 concepts.