PHP Tags

How many Types of PHP tags ?

Basically PHP code can run in Three Types of PHP Tags. Tags tell the server that the code written between the tags should be executed as php code on the server. First tag show the starting of code and second shows the end of the code

These are:

  1. Canonical tags
  2. Short-open (SGML-style) tags
  3. Script Tag

What are Canonical tags ?
Canonical tags are some times call Default tag because it is by default ON on any server where as other not. Canonical Tags are the most common tag use for coding in core php.
It look like

<?php  echo “PHP “; ?>

Output :PHP
What are Short tags ?
Short tags are those tag which does not contain php with <? starting tag. Short tag are by default off on the server in order to use you have to activate or ask server admin to activate it. Short Tags are the most common tag use for coding in php Framework .

It looks like

<? echo “PHP “; ?>

Output :PHP
What are Script tags ?
Script tags are those tag which contain script tag like < script language=”php”>this type of tags are rarely used, it contain a starting tag as well as closing tag like HTML tags
It look like

< script language=”php”>

echo “PHP “;

< /script >

Output :PHP

One thought on “PHP Tags

Comments are closed.