Tony Marston's Blog About software development, PHP and OOP

Support for PHP4 stops, support for PHP7 starts

Posted on 1st October 2016 by Tony Marston

Release 2.00.0 of the Radicore framework officially ends support for PHP4 and starts support for PHP7. For many years I have been able to support both PHP4 and PHP5 with the same code base which meant that users could switch from one to the other at any time without having to change a single line of code. By deliberately ignoring any of the shiny new features which have been added to PHP5 (unless I have found a genuine need for the functionality which they offer, which has been very rare) I have been able to move through all the versions of PHP5 without having to deal with any BC breaks. The only exception to this was the replacement of the POSIX regular expression functions with the PCRE functions following their deprecation in version 5.3.0.

While it was possible to support both PHP4 and PHP5 with the same codebase, it is not possible to add support for PHP7 because of one change - class constructors:

In order to make my codebase run in PHP7 without incident I have therefore had to update all of my classes to replace the PHP4-style constructors with the PHP5 version. While this means that the same code can now run in either PHP5 or PHP7, it will no longer run in PHP4.

Oh dear, what a pity, how sad. Let us bow our heads and observe a minute's silence for the passing of PHP4.

Please note that this is the ONLY change I have had to make to my codebase to make the jump from PHP5 to PHP7. Other developers seem to be having difficulties, even with moving from 5.3.0 to 5.4.0, 5.5.0 and 5.6.0, but that can only be down to the poor quality of the code which they write. As far as I am concerned if you have to keep rewriting your code with each new release of PHP then you are doing something wrong.