0
0
PHPprogramming~10 mins

First PHP program (Hello World) - Mini Project: Build & Apply

Choose your learning style9 modes available
First PHP program (Hello World)
📖 Scenario: You want to create your very first PHP program that shows a friendly greeting on a web page.
🎯 Goal: Build a simple PHP script that prints Hello World on the screen.
📋 What You'll Learn
Create a PHP file with the correct opening and closing tags
Use the echo statement to display text
Print exactly the text Hello World
💡 Why This Matters
🌍 Real World
PHP is used to create dynamic web pages that can show different content to users.
💼 Career
Knowing how to write and run PHP scripts is a basic skill for web developers working with server-side programming.
Progress0 / 4 steps
1
Create a PHP file with opening and closing tags
Write the PHP opening tag <?php and closing tag ?> in a file.
PHP
Need a hint?

Every PHP script starts with <?php and ends with ?>.

2
Add an echo statement to print text
Inside the PHP tags, write echo followed by the text 'Hello World' in quotes and a semicolon.
PHP
Need a hint?

Use echo 'Hello World'; to print the text.

3
Check your PHP code syntax
Make sure your PHP code has the opening tag <?php, the echo 'Hello World'; statement, and the closing tag ?>.
PHP
Need a hint?

Check that all parts are present and correctly typed.

4
Run the PHP script and display the output
Run the PHP script and print the output. The output should be exactly Hello World.
PHP
Need a hint?

When you run the script, the browser or terminal should show Hello World.