PHP5 has been out for over two years now but PHP4 is still the most widely supported form of PHP there is. However, that trend is soon to change and all PHP4 coders should change to PHP5 for reasons we’ll explain below.
First, the transition will not be that painful for most people. Most PHP4 code is written without classes or objects so switching to PHP5 should not break compatibility. The things that PHP5 is not compatible with PHP4 is the object model (because PHP4’s model is outdated) and a few of the array functions.
If you are a developer, I suggest you quickly let go of PHP4 and move on. One reason is that PHP4 will no longer be supported come the end of this year. The PHP group has announced that they will stop making newer versions and enhancements to PHP4 after December of this year. All new development will focus on PHP5. This means that the support and documentation of PHP4 will be lacking after this year is over. Secondly, PHP5 has new options, but does not force you to use them. For the most part your PHP4 skills will still be valid and you don’t have to learn the new object model if you do not wish to learn it. Most all the functions in PHP4 work in PHP5 and you can still use procedural code if you wish. Third, learning PHP5 may convince some clients that you are a “real” programmer. For the longest time some people have not regarded PHP programmers as real programmers saying that they just throw some code together into a script and don’t understand the concept of programming. While this is largely untrue, it does hurt our chances of getting a job. Learning PHP5’s new and improved object model will give you a chance to show that you know real OO programming and design and may improve your status with employers. From a career prospective as a developer, PHP5 is certainly the way to go.
Aside from those reasons, PHP5 provides a lot of new functions that make your job easier than developing in PHP4. Aside from the new object model which you may or may not want to use, PHP5 has a plethora of new functions shown at http://www.php.net/manual/en/migration5.functions.php that will make your life easier. There is better advanced array calculations and handling, more functions for inter base (if your developing with that database in mind), and many new and improved string functions which will make your life easier.
With this new functionality and trend, more employers are going to be demanding PHP5 over PHP4 as the improved object model shown at http://www.php.net/manual/en/migration5.oop.php will make code easier to read, manage, and maintain. Companies such as Yahoo, who are adopting PHP as a major part of their systems will also want to hire people who are well versed in PHP5 as opposed to PHP4.
With all these improvements in PHP and the fact the PHP4 is surely on its way out, there is no reason not to start migrating to PHP5 right now.