ele2

PHP: Version History

Facebook, CNBC, NASA, Wikipedia, Business Insider, Harvard University... these are just some examples of websites built on PHP – the most popular programming language used by 82% of websites. Continuous development and a huge community make PHP the choice of start-ups who are looking for the best web development solutions, as well as large companies and institutions around the world. In the text below I describe how it all began and how the successive versions have changed over the years.

The author of the first version of PHP is Rasmus Lerdorf. It was created in 1994 as a set of Perl scripts for the purpose of monitoring the Internet users visiting the website and viewing the Lerdorf's résumé. It soon turned out that too much traffic requires a response from the programmer, so in the further works, he used the C language and added new options. The interest became stronger and people asked to be able to use these tools for their own purposes, which resulted in the release of Personal Home Page Tools in 1995. Rasmus Lerdorf, however, did not slow down the pace – he added the mSQL service to PHP and combined it with Form Interpreter. Thus PHP/FI saw the light of day, and in 1997 its version 2.0, which already had several thousand users and supported about 50 thousand domains, was released. Since then, PHP/FI started to develop dynamically.

PHP 3

In 1997, Zeev Suraski and Andi Gutmans, Israeli programmers, decided to continue the works on the PHP language. They found that PHP/FI was not coping well enough with the requirements of the eCommerce application they were developing at that time. So, they decided to rewrite the code from scratch, they developed a new architecture, and in 1998 announced the new version.

In PHP 3, the basics of object-oriented programming appeared, but the most distinguishing feature was its modularity, i.e. the possibility of enriching the PHP functionality by adding new modules by users.

In addition, PHP 3 started to support various databases: mSQL, MySQL, PostgreSQL. In many programmers' opinion, the embedded elements were much easier to handle than trying to create separate HTML and CGI files. All of this made the overall performance of websites significantly more optimised and the management of large websites became more efficient as the website components have been collected in a single HTML file.

PHP 4

However, the aforementioned modularity and the issue of efficiency kept bugging Suraski and Gutmans. Driven by the desire for continuous improvement, they undertook further works on the source code.

Thus, in 1999 officially released was Zend Engine – a scripting engine that became the foundation for the development of PHP 4 which was launched a year later.

Within the next four years, released were three more editions: 4.1, 4.2, 4.3, and each of them was characterised by improved safety and speed of operation.

When speaking of PHP 4, a big emphasis should be undoubtedly put on the aforementioned Zend Engine. This open-source scripting engine that interprets the PHP programming language is written in C as an optimised modular back-end. What is important to note here is the fact that for the first time it could be used in applications outside of PHP. The engine manages memory and resources, and its performance and extensibility had a direct impact on the development of subsequent versions of PHP.

PHP 5

When speaking of version 5, it should be said: "quid pro quo". The new object-oriented programming model that was developed cost some of the compatibility with previous versions of PHP. Of course, this is not exactly a disadvantage of PHP 5, because the modules were changed, including those used to handle XML and communicate with the database.

Other significant changes were: the implementation of XML functions into the application's kernel, the complete rewrite of the MySQL extension – one of the simplest, free, open-source database programs, whose performance when combined with PHP 4 was not great, and in PHP 5 the MySQL extension was optimised to be compatible with MySQL 5.0. There was also the __autoload () function, which was designed to speed up the coding time and increase the website's performance. PHP's operation in Windows system was also improved.

In 2009, PHP 5.3 was released, but already in 2005 there was information that works on the new version was launched.

PHP 6

Unicode. The keyword when speaking about version 6. The goal was to remove obsolete solutions, dating back to the times of PHP/FI and PHP3, in order to remedy the continuing problems with compatibility. These changes were related to the implementation of improvements to the object model in the Unicode language.

The creators wanted to add native Unicode support to PHP. However, the problem they faced was the shortage of programmers who saw the need for these changes, as well as the performance issues in the context of the UTF-16 conversion itself.

Finally, in 2010 the project in its current form was officially abandoned and the PHP 5.4 release was prepared without taking into account the Unicode functions of PHP 6.

The never released version 6 is considered a failure. It is not surprising then that the initiative to create the next one was taken.

PHP 7

The year 2014 is considered the official start of works on PHP 7. The basis of the version was an experimental branch – PHPNG (PHP Next Generation), which was designed to optimise performance.

The developers have worked very hard to refactor the code in order to reduce memory consumption and increase said performance. They sure achieved their goal. Benchmarks for PHP 7 show twice the speed of PHP 5.6 and 50% less memory consumption. This is the undoubted success of this version.

Reducing memory consumption allows for better handling of requests, along with the possibility of building micro-services based on PHP. Internal changes also create opportunities for future optimisations that can further enhance the performance. At this point, it is worth to emphasise the JIT compiler, which in turn will appear in all its glory in the newest PHP.

It should be noted that the version number 7 has improved the readability of code by introducing the spaceship operator. It is a combination of all three tags used in its construction, and depending on which is true, it returns a different value. Another operator you should take a closer look at is Null Coalesce Operator (??), which also increases the readability and makes the code shorter. The operator verifies that a NULL value exists and returns the left side of the operator if not, and the right side if so.

And finally, the issue of critical errors. In previous versions, handling them was a nightmare for programmers. That is because if such an error occurred, instead of triggering the error handling procedure, the script would then freeze – a white screen appeared. PHP 7 allows you to remove the exception when an error occurs, but it no longer freezes the entire script. Of course, this also allows for improving the readability of code. ParseError, TypeError, ArithmeticErrors and AssertionError – these errors have been collected in the Error section so that they now generate errors in PHP 7 and were previously critical.

PHP 8

The release of the latest version will take place on 26 November 2020. It's worth reading what's new in PHP 8, but you can certainly point to the JIT compiler, which will soon become a native part of the language.

Summary

In addition to programming, the wide range of PHP development services also includes a large number of libraries created and supported by the community, as well as popular frameworks: Drupal, Symfony or Laravel, on which advanced projects can be developed. At our Drupal agency, we are confident that PHP will continue to be developed, and for many years to come it will be at the forefront of languages used to build websites.

Cover of an e-book