Php Syntax

Php is a scripting language and it is used to create dynamic webpages. It is very easy to learn. Now times more than 70% of websites are built in PHP. every PHP file has .php extension.

Syntax:-


<?php 

?>

Example:- you have to print Hello Php


<?php 
print 'Hello Php';
?>
Hello Php

Try it on PHP Editor

HTML Embedding in php file

You can embedded html code into PHP file


<HTML>
<HEAD> 
This is a sample. 
</HEAD>
<BODY>
Hello Removeload.com
<?php 
print "Hi, how are you?";
?>
</BODY>
</HTML>

How to enable PHP short tag?

You can enable php short tag through php.ini file. firstly open the php.ini file after that short_open_tag=on.


short_open_tag=on

Now, write the PHP code

Syntax:-


<?

?>

Example:- you have to print Hello Friends


<?
print 'Hello Friends';
?>
Hello Friends