An interesting question was raised by dvduval in the SitePoint forums recently: Should we stop coding for PHP4?In a perfect world, the answer is an emphatic ‘yes’ and this was the response most people gave. Few will question that PHP5 offers a more robust object model, requires less code, is more secure and has better performance. It’s also installed by most web hosts, although many offer both PHP4 and PHP5. Finally, PHP4 development and support has ceased: you should certainly be using PHP5 if you’re starting application development today.Unfortunately, we don’t live in a perfect world. Many applications were written when PHP4 was the undisputed platform of choice and updating legacy code to PHP5 may be difficult or offer no business benefits. It’s also possible to create applications which work on either PHP4 or PHP5. WordPress is a good example and, although there are plans to switch to PHP5 only, the developers recognize it will affect thousands of installations and plugins. It’s not an update which can be done on a whim.We’d like to know which version of PHP your web application uses. While I’d expect many people to be working with PHP5, it’s useful to know whether anyone is still writing PHP4-only applications or creating cross-platform code. Please vote on the SitePoint poll and let us know how you came to your decision by leaving a comment below.
If you’re new to PHP or need a refresher, why not sign up for SitePoint’s PHP Live with Kevin Yank? It’s a 3-week interactive course which will help you learn PHP from experts and your fellow students.