0

I have a couple of old applications which were written in around 2003 in PHP4 which I would like to port to a modern, current version of PHP. I want to first get the old functionality working on a modern server before I start rewriting the code to add feature, modernize the UI and update the code for the current state of the web.

But before I start porting I'd like some guidance about what I should be watching for which has changed - what parts of the code will likely require the most care to rewrite?

1 Answers1

0

Depending on who was the programmer that wrote the code in the first place, the thing that has always stood out to me the most in PHP4 versus PHP5 is the way objects are handled. Of course, if he or she didn't use Object-Oriented coding at all, then you wouldn't need to think about that at all.

Also, depending on what version of 4, you're using, register_globals was turned off by default after 4.1 or 4.2, so if the programmer before you was relying on that, you'll have to fix that as well.

user470714
  • 2,858
  • 1
  • 28
  • 34
  • we didn't use a lot of object oriented code but we did do a lot of fairly complex array manipulation (which I understand changed somewhat between PHP4 and PHP5 (when passing arrays) and we did have some pretty tricky things going on re global variables - so I suspect that will be areas I have to rewrite/focus on heavily. Which may be ugly... – Shannon John Clark Feb 09 '11 at 01:09
  • Yea, if I were you, I'd take a look at one of those migration guides, walk through each of the non-forward compatible changes, and scan the app for these 'problems' individually. After that, you might want to look at the kind of functions that might make your app overall more efficient/easy to work with. As you mentioned, there's a bunch of new array functions between 4 and 5. Of course, if your app is very large, scanning the code so many times might not be feasible. – user470714 Feb 09 '11 at 22:37
  • the challenge(s) will be that at least one of the applications did some really complex stuff with arrays (functions that took one or multidimensional arrays depending on the data encountered and would in places almost literally rewrite itself to accommodate the data encountered) so I suspect arrays may be among my bigger headaches – Shannon John Clark Feb 10 '11 at 03:22