PHP - Syntax

In this topic i will explain about php sysntax in details there are many whay and many type php sysntax like default and and with html and more about php syntax the below list are types of php syntax we covered in this topic.

      Default Syntax

      Short Open Tags

      HTML Script Tags

      ASP Style Tags

Default Syntax

The default syntax starts with "<?php" and ends with "?>", generally most of used this syntax start with <?php and end with ?> tag in php syntax the following basic syntax example.

Syntax



<?php
Your Code Here
?>							
							

Example



<?php
	echo "This is Default Example";
?>						
							

Short Open Tags

The short tags starts with "<?" and ends with "?>". Short style tags are only available when they are enabled in php.ini configuration file on servers.

Syntax



<?
	Your Code Here
?>						
							

Example



<?
	echo "This is Short Open Tags Example";
?>						
							

HTML Script Tags

Write php script using html script tag.you can used <script language="php"> tag and write your code.

Syntax



<script language="php">
	Your Code Here
</script>
							

Example



<script language="php">
    echo "This is HTML Script Example";
</script>
							

ASP Style Tags

The ASP style tags starts with "<%" and ends with "%>". ASP style tags are only available when they are enabled in php.ini configuration file on servers.

Syntax



<%  
	your code here  
%>							
							

Example



<%  
	echo"This is a ASP Style Syntax";  
%>						
							

Complete Example


>
<?php
	echo "Company Name : Veewom Technology";
	echo "Address : Bhavnagar,Gujarat,India 364001";
	echo "Phone : 012584754";
	echo "About : Veewom Technology is Web Development Company
?>
							

Output



Company Name : Veewom Technology
Address : Bhavnagar,Gujarat,India 364001
Phone : 012584754
About : Veewom Technology is Web Development Company
							
							
Share Share on Facebook Share on Twitter Share on LinkedIn Pin on Pinterest Share on Stumbleupon Share on Tumblr Share on Reddit Share on Diggit

You may also like this!