php4 files to php5

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
leewad
Forum Commoner
Posts: 91
Joined: Tue May 11, 2004 8:32 am

php4 files to php5

Post by leewad »

Hi

Does anyone know the easiest way of converting php4 files into php5, I have lots of files which now dont work with php5 so need someway of testing the files to see which part of the code is invalid. Is there any software available to convert the files into php5 of software that will test the code and highlight the invalid sections?

Thanks
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

I am not aware of any such software but this might help you in the process:

http://php.net/manual/en/faq.migration5.php
User avatar
superdezign
DevNet Master
Posts: 4135
Joined: Sat Jan 20, 2007 11:06 pm

Post by superdezign »

PHP4 files are completely compatible with PHP5. The only problems would be deprecated syntax, namely using short tags (i.e. <?) instead of regular <?php tags. If you do a "Find and Replace" on "<?= " and replace it with "<?php echo ", and then do the same on "<? " and replace it with "<?php " (remember to keep the space at the end of the strings in the search and replace queries as I have).
User avatar
John Cartwright
Site Admin
Posts: 11470
Joined: Tue Dec 23, 2003 2:10 am
Location: Toronto
Contact:

Post by John Cartwright »

Different configuration settings on the server may be the reason also, namely register globals is a common issue.
Post Reply