Zacky112
Zacky112

Reputation: 8879

Which PHP tags are always available?

Of the 4 types of PHP tags:

Which is/are always available ?

Upvotes: 3

Views: 924

Answers (4)

HungryCoder
HungryCoder

Reputation: 7616

so far I know PHP's short opening tag is going to be completed deprecated from PHP 6. So it is beast to use .

Upvotes: 1

phpbugs
phpbugs

Reputation: 43

You have to use <?php tag. You can use <? tag when the "short open tag" property is "On" in your php.ini file.

Upvotes: 0

Pekka
Pekka

Reputation: 449605

The standard <?php and the <script> tags are always available.

The two others depend on configuration settings.

From the reference:

There are four different pairs of opening and closing tags which can be used in PHP. Two of those, <?php ?> and <script language="php"> </script>, are always available. The other two are short tags and ASP style tags, and can be turned on and off from the php.ini configuration file. As such, while some people find short tags and ASP style tags convenient, they are less portable, and generally not recommended.

Short tags are only available when they are enabled via the short_open_tag php.ini configuration file directive, or if PHP was configured with the --enable-short-tags option.

ASP style tags are only available when they are enabled via the asp_tags php.ini configuration file directive.

Upvotes: 5

Ben Everard
Ben Everard

Reputation: 13804

You should always use the PHP tags <?php and ?>.

These tags will always be available on a PHP server, whereas the shorthand tags (<? + ?>) can be turned on and off in the php.ini file, I generally go with <?php ?> as this increases portability.

Upvotes: 5

Related Questions