USA/UK English

What’s new in PHP 8.0?

PHP is one of the easiest programming languages ​​to learn. With a tutorial and the right motivation, you can write your first scripts and run commands in a few hours.

PHP 8.0 is a major update to the language, released in November 2020, it brought a lot of new features and optimizations.

In this article, we explain some of the most relevant new features. Let’s go?

What is PHP?

The release of PHP in 1995 opened up a whole new world of possibilities for webpage development and design. Web, all with unprecedented levels of scalability, security and customization. To this day, PHP provides developers with a versatile testing environment to run server-side scripts, command-line scripts, and desktop application builds.

PHP provides the backbone for a wide range of primarily web-centric application functions such as dynamic content management, remote database integration, and user session tracking. Programmers can also use PHP to request elements directly from a server or database and then make that content easily accessible to web users.

PHP 8.0 established new paradigms in the language being a big update. The version brought changes that can be attributed in three categories:

  • execution strategy;
  • language syntax;
  • new features.

Each category has made the language much more advanced than its previous versions. In addition, PHP 8 is also focusing on providing developers with opportunities to bring more expression into their code with less coding.

The quality, functionality and performance of websites created in PHP will certainly suffer major improvements with this update.

What are the main new features of PHP 8.0?

While PHP 7 offered performance and security improvements, PHP 8 represents a major release with substantial new features. These features include the just-in-time (JIT) compiler, a named arguments method, static return types, inheritance, and OPcache extensions. But, that’s not all.

JIT Compiler

For any language or even applications , the biggest and most compelling improvement may be in speed and performance. And the new JIT or Just-In-Time compiler does the same for PHP.

PHP is an interpreted language, which means it runs in real time instead of at a predetermined time after have been compiled. JIT makes PHP run on compiled code and this improves its performance in certain scenarios. Let’s understand this with a chronological explanation of PHP executions before and now, that is, with PHP 8.

Previously, each request meant that the interpreter had to parse, compile and execute PHP code each time separately. This required more use of CPU resources and more investment of time.

Next came preload, a feature implemented in OPcache in PHP 7.4. It provided a means of storing sets of scripts in OPcache memory before any application code was actually executed. However, this really improved performance.

Finally, in PHP 8 JIT compilation is introduced. In previous versions, scripts still needed to be compiled into machine code. The new addition skips this step completely. The JIT compiler translates all parts of the intermediate code into machine code, bringing a substantial improvement in performance and in the way memory was used.

Although JIT has been available in PHP files since version 7.4, it was just a testing tool with no compile time and performance and usability only kicked in with version 8. Now, performing tasks like data analysis, 3D rendering and AI has definitely improved the developer experience. Given that many of PHP’s counterparts have already benefited from JIT compilers, it was a long-awaited addition that opened up many new horizons for the language.

Mostrar mais

Artigos relacionados

Deixe um comentário

O seu endereço de e-mail não será publicado. Campos obrigatórios são marcados com *

Botão Voltar ao topo