Mixing <? and <?php causes trouble

I had to made some changes to an old PHP-Project (with very poor code quality…) which runs on an PHP 5.3 server.

So I’ve downloaded the project and tried to run it locally (xampp with PHP 5.3) and I ende up with an error:

Parse error: syntax error, unexpected ‘}’ in somefile.php on line 74

I’ve noticed that in this file the tags

<?php ?>

and

<? ?>

were mixed all over the place.

After some trial and error with replacing <? with <?php , I was able to get it working, but I would like to know what is causing this trouble.


Source: php

Leave a Reply