0
0
PHPprogramming~5 mins

First PHP program (Hello World) - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
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?
A&lt;script&gt;
B&lt;?php
C&lt;php&gt;
D&lt;?&gt;
What does the echo statement do?
AOutputs text to the screen
BStarts a PHP script
CEnds a PHP script
DDeclares a variable
What symbol ends a PHP statement?
A;
B.
C:
D,
Can PHP code run directly in a browser without a server?
AYes, always
BOnly in some browsers
CNo, it needs a server
DOnly on mobile browsers
What will this code output? <?php echo "Hello World"; ?>
Aecho "Hello World";
BNothing
CError
DHello World
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.