Sunday, February 15, 2009

How to Define PHP Tags?

  Kaushal Patel       Sunday, February 15, 2009

Canonical PHP tags

This style is most universally effective and popular PHP tag style. It looks like this:

<?php ?>

It is safe to use this style as some of the other style of php tags may be phased out in the future.

Short-open (SGML-style) tags


This is a shortest option of php tag style. It looks like this:

<? ?>

You must do one of two things to enable PHP to recognize the tags:
· Choose the --enable-short-tags configuration option when you’re building PHP.
· Set the short_open_tag setting in your php.ini file to on. This option must be disabled to parse XML with PHP because the same syntax is used for XML tags.

ASP-style tags


This Style of tags is just like Microsoft’s ASP Style tags. It looks like this:

<% %>

To use ASP style tags you should change the php.ini configuration

HTML script style tags


HTML script style tags is looks like this:

<SCRIPT LANGUAGE=”PHP”> </SCRIPT>

When using this kind of style be careful if you are using lots of javascript then the close tags are fatally ambiguous.

logoblog

Thanks for reading How to Define PHP Tags?

Previous
« Prev Post

No comments:

Post a Comment