Hello World Program In PHP

In this tutorial we will learn Hello World Program In PHP. In last tutorial we learnt how to install and start virtual server in PC to run PHP code. Here we will learn basic PHP Syntax and learn how we can write Hello World program in PHP.

Hello World Program In PHP

First of all we will create a folder in htdocs folder to save our PHP files. I am creating folder named PHPTutorials. You can see it in image given below.

Hello World Program in PHP

In this PHPTutorials folder we will create file "HelloWorld.php". Always keep in mind save every file in php with .php extension.

Note!You can use any text editor to write PHP code like Notepad, Notepad++, Sublime Text. We will use here Sublime Text.

Basic PHP code Syntax:

To keep PHP code separate from HTML and CSS we have to write PHP code in Canonical PHP tags () mean we will write whole PHP code inside these tags. Now we will see an Example of Hello World program.


As you can see we have wrote our PHP code inside Canonical PHP tags which keep it separate from rest of code. we have used echo to show output on the screen which is Hello World. Now please save this file as HelloWorld.php in PHPTutorials folder. After saving it we will run this code in browser.

Note!Please keep your xampp server on to run PHP Code.

To run code make sure your XAMPP server is on then type this localhost/PHPTutorials/HelloWorld.php chrome address URL bar and hit enter. You will see output like this.

Hello World Program in PHP

Share this tutorial with your friends on your social Media..

Hello World Program In PHP Hello World Program In PHP Hello World Program In PHP Hello World Program In PHP

Now You Can Follow All These Tutorials on Your Android Mobile Just Download This App.