PHP Hello World Program


PHP Hello World Program

In this tutorial, we will learn how to write a Hello World program in PHP language. We will go through each statement of the program.

PHP Program

<?php

echo "Hello, World!";

?>

Output

Hello, World!

Working of the "Hello, World!" Program

  1. <?php
    This opening tag indicates the start of PHP code.
  2. echo "Hello, World!";
    This line prints the string "Hello, World!" to the output. The echo statement is used to output text to the web page or console.
  3. ?>
    This optional closing tag indicates the end of PHP code. In most modern PHP applications, the closing tag is omitted to prevent trailing whitespace issues.