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 Introduction
PHP Terminology
PHP Installation
PHP Syntax
PHP Comments
PHP exit() Function
Exercises & Assignments
Write a program to print “Hello World” using echo
Simple Tips for PHP Beginners
Experiment with Basic PHP Syntax Errors
Using phpinfo() – Display PHP Configuration & Modules
Interview Questions & Answers
What is PHP?
Who is the father of PHP?
What is the correct & common way to start and finish a PHP block of code?
What is Open Source Software?
What is the default extension of the PHP file?
What is the latest version of PHP?
What is the full form of PHP?