Create a “Hello World” program in PHP


Are you a beginner? And want to learn about how to create a hello world program in PHP?

Then you are in the right place.

You are going to see:

Start and End Tags in PHP Start and End Tags in PHP

To execute the PHP code we need to use the PHP start and end code.

To start the PHP code you need to use <?php

And its ends with ?>

Every code within the <?php and ?> will execute.


     // PHP code goes here.

Top ↑

Example of “Hello World” program Example of “Hello World” program

Follow below Hello World code sample:

     echo 'Hello World';

When you execute the PHP code then you’ll see the “Hello World” text.

Note: Here we have used the echo keyword which is used to print the text.

You can use it with print() as:

     print( 'Hello World' );

Or you may use the print_r() as:

     print_r( 'Hello World' );
%d bloggers like this: