PHP - PHP Example

PHP Example - In this tutorial we learn how to write first php example in our code editor. First we lean the starting and ending tags of PHP that helps programmers to start the php code. Basically PHP tags starts with (<?php ) symbol and ending with ( ?> ) , so we write php code in between these two php tags. This will tell the php compiler that in our page we insert the php code in between these two tags.

Basically it is necessary to save the file with .php extension

All PHP code goes between the php tag. Syntax of the PHP tag is given below:

//your code goes here  


Let's see a simple PHP example where we are writing some text using the PHP echo command.

File Name : helloworld.php

echo "<h2>Hello World PHP</h2>";  


Output :

Hello World PHP

<< Prevoius Next >>