ASPit - Totally ASP JSit - Totally JavaScript
Search PHPit

Use this textbox to search for articles on PHPit. Seperate keywords with a space.


Abandoning PHP4?

There's an interesting discussion over at SitePointForums over whether it's time to abandon PHP4, and code exclusively for PHP5 now. Just to pull some random quotes out of the discussion:

PHP4 is the norm in 100% of my projects right now. I'm not happy about it and would love to migrate as quickly as possible. It's just not happening fast enough. I would expect the big shift to happen some time this year.

No one knows, but as far as I'm concerned, PHP4.yuk is dead and buried. Let the celebrations continue

I sell a commercial application that requires PHP5. I think that sales have been hurt a bit by the fact that PHP5 support in shared hosting environments is far from ubiquitous. Right now I'm averaging about 2-3 sales per week with one in three buyers emailing me after the fact saying they just realized their host doesn't support PHP5 yet.

Not only that a very small minority of hosts use PHP 5. While everyone has fully accepted PHP 4. We need a better motive to switch.

Some say PHP4 is dead, others say it's still very alive and kicking, but the last two quotes really nail the issue. It isn't about whether we (developers) think PHP4 is dead, it's about whether the market thinks it's dead. I'm sure all us would love to code under the latest stable version of PHP5 (and PHP6 when it comes out), but if you can't control the environment your script is going to run in, you must make sure it works on almost any platform.

Seeing as how there are still a lot of web hosts who do not support PHP5 yet, it seems fairly logical to stick to PHP4, until at least 90% of the market has switched to PHP5. When will this happen? I have no idea, but hopefully sooner rather than later, especially with PHP6 coming sometime next year (2007).

I personally still code in PHP4, but I do make sure my scripts work under PHP5, which means I get the best of both worlds, and my scripts can be used on almost any platform.

4 Responses to “Abandoning PHP4?”

  1. Mike Willbanks Says:

    At my work we code in PHP4 and make them run for PHP5. One of the things I do with my personal development is create seperate branches for the different versions so I can utilize the different programming methodologies that are present in the different versions.

    This allows to support different versions and since there is not usually too much to change between 4 and 5 it is not that big of a deal. I have found the biggest thing is just backporting functions to php4.


  2. Dennis Pallett Says:

    Hey Mike,

    Isn’t that a lot of hassle though - maintaining different versions? How do you call different versions anyway? E.g., you release version 1.2 of your script, what is the PHP4 version called? 1.2.4 and the PHP5 version 1.2.5 or something like that?

  3. h4rdc0m Says:

    We at our company host sites for our clients too, the problem is that one part of the clients is ready for php5 and a big part of them just isn’t. So carrying out an update as a webhost is not always trivial, why change something that works and has worked for a long time.

    And I personally don’t really see that much improvement in PHP5, as in I can do everything I want with PHP4, why switch over?

    There are some things I like though constructors and destructors. But I just dislike the fact that they made variables passing by reference, I liked the fact that I could specify if I wanted by reference.

  4. Mike Willbanks Says:


    Sorry for the late response. It really isn’t a lot of hassle.
    Most of the time you will find that there are very little changes that you may need to make between versions keeping just about all of the source code the same.

    As far as version numbers they are all the same version number just one is for php4 and one is for php5. Take PHP for instance. They have apache 1 hooks, apache 2 hooks, iis hooks, fastcgi, etc. These are all maintained and many times you may find duplicate code in each but the versions are practically always the same.

    These are things to think about and it really depends on what your target platform is and if there is a substancial difference. If you really do not need php5 functionality then you may not want to use it, if there is a vast improvement in how the code would operate it may be a very good idea to create different versions.

Leave a Reply