guarriman Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/ Share on other sites More sharing options...
helraizer Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. Why not just use a text editor like NotePad phpDesigner or any other and use Find & Replace? Find: <? Replace with: <?php Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-398866 Share on other sites More sharing options...
Agoniscool Posted November 25, 2007 Share Posted November 25, 2007 I highly recommend Notepad++. Great program, and it's free! Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-398879 Share on other sites More sharing options...
wildteen88 Posted November 25, 2007 Share Posted November 25, 2007 Hi. I want to migrate from PHP4 (where I use '<?') to PHP5 (where I must use '<?php'). Do you know a program or a Linux script to do it? Thank you very much. PHP5 does support the short tags (<? and <?php=) all you need to do is enable a setting called short_open_tag. However if your script is small then I'd recommend you to convert the short tags to their respective full version. Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-398963 Share on other sites More sharing options...
runnerjp Posted November 25, 2007 Share Posted November 25, 2007 yes i would use <?php as php5 wants you to use it for a reason Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-398985 Share on other sites More sharing options...
trq Posted November 25, 2007 Share Posted November 25, 2007 Something like.... #!/bin/bash for file in $(ls -R htdocs/*.php) ; do sed -i -e 's/<?$/<?php/g' $file done would probably go close. Not tested. Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-399007 Share on other sites More sharing options...
PFMaBiSmAd Posted November 26, 2007 Share Posted November 26, 2007 Don't forget that <?= would need to be changed to <?php echo Link to comment https://forums.phpfreaks.com/topic/78815-scriptprogram-to-convert/#findComment-399066 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.