Well, this small tutorial will contain the very very basics of the programming language PHP in regards to the difference used with PHP tags.
When your write a program with PHP, the browsers render engine will interprets all HTML code what comes in his way. You can “escape” the HTML code by using PHP tags. At this point, the render engine will recognize your php code by the therefor used php tags. Everything written between this tags will be recognized as PHP.
There are three (Commonly used) kind of PHP tags:
Let start with the first one, which is the commonly used one, the canonical tags.
<?php /* * Above: Open tag * Below: Close tag */ ?>
The second will be the short open tag. When you use this feature you have to set ‘short_open_tag’ within the php.ini to ‘On’. Otherwise this tag will not be recognized for PHP. However, there is a little disadvantage when using this tag. Since XML is using the same tags and your desire is to use XML in combination with PHP, you better turn this feature off.
An example of xml tags:
'<?xml ?>'
Short open tag
<? /* * Above: Open tag * Below: Close tag */ ?>
At last, but not least, the script tags. Maybe, when you’re more familiar with HTML, you know this kind of tags.
<script language="php"> /* * Above: Open tag * Below: Close tag */ </script>
As you can see, there are several options for you. But, as this kind of tags are commonly used, i recommend you use the (canonical) tags as this will assure you of correct handling by each program, render engine or what ever.
Mail this!
- Comments (0)
- PingBacks (0)
- TrackBacks (0)

» Latest comments