1

PHP short open tag

Posted December 23rd, 2006 in Programming, Web by Olexandr Melnyk

I’ve had a problem when using XML declaration in a web page:

<?xml version="1.0" encoding="utf-8"?>

which was caused by a conflict with PHP short open tag. The solution was to disable it with .htaccess (what was allowed by my friend’s VPS, where this website is currently hosted):

php_flag short_open_tag off

This is yet another argument against using short open tag (not to mention that it’s support is likely to be dropped in PHP 6).

UPDATE: Short open tag is likely to stay in PHP 6, but because of the problems like the one described above, I would still recommend against using it.

Share and Enjoy:
  • Facebook
  • VKontakte
  • MySpace
  • LinkedIn
  • Twitter
  • Identi.ca
  • Tumblr
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Google Bookmarks
  • Google Buzz
  • Live
  • Technorati
  • HackerNews
  • Slashdot
  • Hyves
  • Tuenti
  • PDF
  • http://www.evopsych.com spazdaq

    or instead of turning off such a useful feature, in rare scenario of creating an xml template where php naggingly turns on, you could simply echo out the xml definition before closing your php tags as such.

    echo” .”\n”

blog comments powered by Disqus