Jump to content

PHP4 to PHP5 Conversion


anujgarg

Recommended Posts

Hi Everyone,

 

I am working on a site that is built up on PHP4 and each page is being started from <? instead of <?php as of PHP5.

 

I want to convert this <? to <?php on every page so that I can render the page properly in the browser. I am using WAMP Server 2.0 and it is creating problem to display the page in the browser if <? is there in the php file.

 

Please suggest...

 

TIA

 

Anuj

Link to comment
https://forums.phpfreaks.com/topic/178305-php4-to-php5-conversion/
Share on other sites

Most programming editors have a search/replace feature that would allow you to find and replace the occurrences of <? and <?= with <?php and <?php echo

 

And the <? vs <?php has nothing to do with php version, but with a second shorter tag that unfortunately can be turned off (what were they thinking) and there is no guarantee that you will always be on a server where you will have the ability to turn it on.

 

It is much better to spend the few minutes correcting your code  once, than fighting something every time you switch to a different server or someone makes a change to your server configuration.

That is indeed the correct setting however your still better off switching your tags.

 

Most good text editors have string replace functionality, and most IDE's will replace over an entire project. Of course you could also use a combintaion of find and sed if your on Linux and get stuck.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.