Write a program to print “Hello World” using echo

Description: Write a PHP program to print “Hello World” using echo only.

Rules and hints:

  • You can not use any variable.
  • End every statement with a semicolon.

PHP program to print Hello World

<?php
echo "Hello World";
?>

Output:

Tutorials Class - Output Window

Hello World

How it works

  • <?php and ?> are the PHP tags.
  • echo prints the text on the page.
  • The text is in double quotes, and the statement ends with ;.

Related: PHP Syntax and echo vs print.


Learn more about the similar topics:
Tutorials
PHP Variables
Exercises & Assignments
Write a program to print “Hello World” using echo
Write a program to print “Hello PHP” using variable
Write a program to print a string using echo+variable.
Write a program to print two variables in single echo
Interview Questions & Answers
How to check if a variable is empty in PHP?
Is PHP a case sensitive language?
What are the different data types in PHP?
What is the difference between $var and $$var in PHP?
Which special characters are allowed in PHP variable names?
Can we print multiple variables in a single echo statement in PHP?
How to check the data type of a variable in PHP?