0

hi i am working on a project of my college but my college server admin told me that we don’t use short_open_tag in our code what’s its mean? what is short open tag and what is alternate of it

thanks

  • You didn't ask but the main reason to avoid using short open tags is that your code will be more portable (because it may have to be run on a server that doesn't allow short tags) and it makes writing XML documents easier (short open tags would require a call to echo, i.e., `echo " – webbiedave Aug 24 '10 at 23:06

2 Answers2

3

Normally you write PHP like so: <?php PHP CODE HERE ?>. However if allow_short_tags directive is enabled you're able to use: <? PHP CODE HERE ?>. Also sort tags provides extra syntax: <?= $var ?> which is equal to <?php echo $var ?>.

Short tags might seem cool but they're not. They causes only more problems. Oh... and IIRC they'll be removed from PHP6.

Crozin
  • 43,890
  • 13
  • 88
  • 135
0

You can try the tool at:

http://blog.eezgu.com/php-short-open-tag-sorunu-ve-cozumu.html

This is a PHP command line tool that converts short tags to normal PHP tags.

The page is not English but you can click the link in the post and download the tool.

Peter O.
  • 32,158
  • 14
  • 82
  • 96
Eren
  • 1