Any disadvantages with short opening tag in PHP ?

Asked By 20 points N/A Posted on -
qa-featured

Are there any disadvantages if we use PHP short opening tag?

SHARE
Best Answer by Peter09
Best Answer
Best Answer
Answered By 0 points N/A #126373

Any disadvantages with short opening tag in PHP ?

qa-featured

Hi Lakshanj,

One of the advantages of coding PHP with the use of short opening tags is a easier and faster method compared to writing code in the standard opening tags. This is true of course when you create a template that will be used often.

The disadvantage of using this method of coding is that first you have to make sure that short_open_tags had been enabled by you or your web hosting provider. If your short_open_tags had been disabled then your application won't work and you will have a number of security issues because of this.

This is because when short_open_tags has been disabled only standard opening tags will be recognized. If your aim is to create PHP applications that will be accessed by a lot of people it is not recommended to make use of short opening tags. Even in PHP manuals it is not advisable to use short opening tags.

Answered By 0 points N/A #126374

Any disadvantages with short opening tag in PHP ?

qa-featured

The disadvantage of using short tags is that it is not allowed in some host and hence your code will be incompatible in all those servers. For the same reason, using short tags is not the best practice. Short tags are not part of coding specification.

In the php.ini-production file provided with PHP 5.3.0, they are disabled by default.

So, using them in an application you want to distribute might fail.

Answered By 0 points N/A #126375

Any disadvantages with short opening tag in PHP ?

qa-featured

 

Lakshani,
 
PHP short tags can be used extensively but there are disadvantages when using those tags. The disadvantages when using PHP short opening tag is that they are not only used in PHP but they are also common in other languages. Using PHP short opening tag is not recommended in many applications.
 
Because most of the time, PHP short tags are not supported on all servers. PHP short tags sustain PHP installations, but there are a small number of installations that have turned it off. Using PHP short tags are well thought-out bad. Because PHP short tags are considered in inconsistency with XML's open tag. Hope that these information could help you.
 
Sincerely,
 
Rizza

Related Questions