The developers have released the eighth version of the PHP programming language
A group of enthusiasts led by the Danish programmer Lerdorform Rasmus released the eighth version of the PHP scripting programming language. The release took place on November 26, 2020, almost a year earlier than planned. PHP 8 introduces several significant improvements compared to the previous version, including the use of a JIT compiler and a significant revision of the “syntactic sugar,” which reduces the volume of template code.
The PHP programming language has been under development since 1995, primarily used for developing dynamic websites with server-side code execution. Additionally, PHP programs can be compiled for execution on UNIX operating systems and in the Windows environment. The syntax of PHP has been influenced by several programming languages, such as C++ and Java.
The most notable change in PHP 8 is the introduction of a JIT compiler. This compiler translates program code into machine code in real-time during program execution, potentially increasing the speed of application execution, especially for mathematical operations.
Another practical improvement in PHP 8 is the addition of the match expression. Similar to the traditional switch statement, the match expression allows for strict value comparison. The result of the match operation can be stored in a variable, used in subsequent code, or returned using functions like echo. Unlike switch, the match expression supports single-line expressions without the need for the break construct.
PHP 8 also introduces named arguments, which can be used in libraries or associative arrays. Unlike PHP 7, this feature allows for self-documented arguments that can be used in any order, skipping optional parameters. This improves code readability and reduces code volume, especially when working with libraries that use boolean parameters.
In PHP 8, structural metadata can now be declared using native PHP syntax instead of PHPDoc annotations. This allows for better integration with development environments and reduces the need for external hints. Additionally, PHP 8 allows for simultaneous declaration and initialization of properties in class constructors, resulting in more concise code.
Lastly, PHP 8 introduces the Nullsafe operator, denoted by “?”, which eliminates the need for repetitive null checks. With the Nullsafe operator, a sequence of calls will return null if at least one element in the chain is null, streamlining null handling in the code.
For a more comprehensive list of PHP 8 innovations and documentation, refer to the release message.
In mid-2018, British developer Dylan Beatty introduced Rockstar, a new dynamic programming language inspired by famous rock songs from the 80s. Its syntax captures the essence of the music and adds a unique touch to the programming experience.