Monday, August 30, 2010

PHP 5.3.3 short tags problem when upgrading

Recently after upgrading php to 5.3.3 I found a problem with short tags <?= and <? , it seems that you now must only use <?php as starting tag, and all my code with <?= was not processed by php.


Short tags looks nicer and cleaner but can be a problem for people using XML, find more info here:

http://wiki.php.net/rfc/shortags

Here is a useful command if you need to replace this tags in your old code:


grep -oiR '<?=' /path/to/dir | cut -d ":" -f 1 | xargs sed -i 's/<?=/<?php echo /g'

No comments: