PHP 5 to PHP 8 - modern programming language


Short history of troubles

The first release of PHP was in 1995 and it’s usage grew rapidly. Regular version updates providing additional functionalities were pushed until 2014, when PHP 5.6 was released. But in 2014 it was already too late. PHP from the very beginning was very easy to use and learn and was a very forgiving language - which was both it’s reason for great success and trouble on the other hand. In the years 2010 to 2016 there were more and more voices from the developers community that PHP failed to follow modern programming language practices and was not strict enough for developers to enforce a good, proper code. This also resulted in more and more backend programmers moving to ASP.NET and Python for web development. Additionally, due to internal conflicts around PHP6 (which aimed to provide Unicode support) ZEND development was behind current standards. But PHP was still the most used web language, and the community heard those voices and reacted. Because of wide PHP usage, it was quite difficult to develop a language up to modern standards while keeping backward compatibility, but the community faced those issues. Thus, after a long time, PHP 7 and then PHP 8 was released, providing answers to many troubles that were a pain for PHP developers.

Reasons for delay

There were two main reasons for delay in the new PHP version releases. The first one is that there was a branch called PHP6 which aimed to provide Unicode support albeit there were many conflicts around this version and the value that it provided was still very low. It’s true that this caused languages such as Python or C# to be better in this aspect, but it’s equally true that most programmers code in English anyway. In the end, PHP6 was abandoned, although it did cost the community a lot of time and effort that otherwise could have been used better.

The second reason for delay was backward compatibility. Since 80% of websites still use PHP as their backend language, there are dependencies that had to be taken into consideration during the development of PHP7. Thankfully, the developers did a great job and also this time, they allowed other solutions to appear, which helped to move from PHP 5.6 to PHP 7 - such as PHP FPM (first non-experimental release in 2011).

Main issues with PHP5

The main issue with PHP was that it was too easy to learn - which was both its strong and weak side. While the strong side is obvious, the weak side was that programmers without experience were able to build applications that were working but, due to bad reasoning and bad approach, were either unsecure or prone to errors. Not to mention the huge mess in the codes themselves.

Some specific problems that caused developers to consider PHP5 as obsolete and bad were:

  • No ability to enforce function parameter types
  • No ability to enforce function returns
  • Bad exceptions handling
  • No modern features, like spaceship operator, null coalesce, JIT ability
  • Complicated operations on strings
  • No native JSON handling (only by extension)
  • Due to PHP5 was not forcing good code by design, a lot of bad code was created

It’s worth noting that all of the above and much more was addressed and fixed by PHP 7 and 8.

Frameworks and PSR to the rescue

Some of the issues that appeared in PHP5 were addressed by creating standards. The following frameworks were created: Symphony, Laravel, CakePHP, Codeigniter; they were almost immediately loved by the community. Frameworks enforced working within specific frames - like MVC or MVVC - so applications created using those frameworks were immediately better organized.

At some point PSR standards were created - you can read about them here: Those standards included some elements that are enforced (like how to create classes) and some that were not enforced (like how to comment your code). Even though some of them were not enforced by the language itself, many editors (for instance Visual Studio Code) allowed to install plugins that helped developers almost automatically comply with these standards.

All of this resulted in a much better code overall.

PHP7 and PHP8 improvements

Moving to PHP7 or PHP8 allows developers to use much more functionality that resembles other languages. Some elements are very similar to C# or C++ or even scripting languages like Python. The full list of improvements can be found on Wikipedia, some of them I already mentioned in this article, but there’s one more aspect.

Between PHP5.6 and PHP8.1 there is a significant improvement in speed and memory usage. It was measured that PHP8.1 is 3 to 4 times faster than PHP5.6! Additionally, the amount of memory usage dropped by about 3 times.

This is the result of rewriting ZEND – the PHP interpreter engine, written in C. Both code optimizations and better memory handling are currently a much more important factor than in the past, because end users expect websites to open almost immediately. Research results show that if a website is loading too slow, users are more eager to close the page without even viewing it’s content. That’s why speed improvement is such a big deal.

Market needs

Almost 79% of websites use PHP. So that’s a big deal and it’s currently impossible to imagine the web without PHP. Because of the great success of this language, for many more years we will need PHP developers - both those working on frameworks (Laravel, Symfony), and those working on CMS sites (like Joomla or WordPress).

Because of that, the number of job offers is not dropping and it is essentially impossible that it will drop in the following many, many years.

What can be better?

Of course, PHP is not a perfect language, it still needs some improvements. Even though there are already some improvements that are implemented, people don’t know that they exist (like the ability to handle processes - so asynchronous execution is possible). What definitely could be improved is machine learning for AI - this is a field that is currently best handled by Python. Another area where PHP can be improved is adding native interfaces for IoT devices (since there are more and more of those) and also preparation for handling Web3.0 (smart contracts).

So, where are we now?

PHP language lives and is in good shape - better than ever. A lot of websites still use it and it does not seem that it will change in any way. PHP is a much more modern language than it was 5 years ago when it had troubles - troubles that had been addressed. Because of that, there is still a lot of work for PHP developers and it is certain that it will not change in the future. 


Let's talk