Blog / PHP 8.0 now available

PHP 8.0 now available

by SW Team

A few months after PHP turned 25, its version 8.0 has just been released. PHP continues to be the most widely used programming language on the Internet when it comes to generating dynamic web pages and SW Hosting already offers it to you completely free of charge, included with all our Shared Hosting products and with our Cloud with SW Panel Smart Web.

This is a major update of this programming language (major update) having especially an important novelty: Jit Compiler.

Jit Compiler

This is the main novelty of PHP 8. This feature has been in development for years and represents a great change for the PHP language.

JIT (Just in Time) is a compiler that will allow you to compile certain parts of the code at runtime.

The JIT compiler is disabled by default, but it can be enabled from the php.ini file and will allow the native code of the PHP files to be stored in a shared memory region called OPcache.

Activation of the JIT compiler can multiply the performance of some types of tasks, especially those that need a lot of CPU resources.

Other improvements

PHP 8 also incorporates several minor changes such as:

• Use of named arguments. It is no longer necessary to match the order of the parameters with the parameter list of the methods used.

Automatic property propagation. Until now, when defining a property in PHP, we were forced to repeat it up to three times before we started using it. This new feature allows us to significantly reduce the amount of code.

Support for union types. Before, we could only specify union types using PHPdoc annotations, but now there is support for union types in function signatures, thus saving us a lot of code.

Match expression: PHP 8.0 incorporates a new match expression similar to switch, but with more secure semantics, as well as the ability to return values.

New nullsafe operator. Until this version, when we wanted to check in PHP that a getter did not return null, we were forced to nest successive ifs. From now on, the first getter that returns null will abort the execution of the entire string.

Throw expression. Throw was a statement, so it was not possible to use it in places where only the use of an expression is allowed. From now on, however, it will be considered an expression.

Don't wait any longer and enjoy PHP 8.0 with our Hosting and Cloud with SW Panel Smart Web products.

i