On November 26, 2023, PHP 8.0 achieved its end of life (EOL), meaning that it will no longer receive fixes or updates.
The 26th of November, 2020 saw the introduction of PHP 8.0, which included several enhancements and new features including named arguments, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and more.
Any websites that continue to use PHP 8.0 after its End of Message (EOL) might face security and compatibility problems if they don’t update to a newer version of the PHP language.
Vulnerabilities that hackers may use to breach the website or its data are examples of security threats. Errors or malfunctions resulting from modifications to the PHP programming language or the underlying web server software are referred to as compatibility problems.
W3Techs reports that 19.9% of all PHP-using websites that are familiar with server-side programming language utilize a version of PHP 8. Out of them, 45.8% expressly use PHP 8.0.
With 61.5 percent of all known websites still using PHP 7, PHP 8 is the second most common version of the PHP language. The EOL for PHP 7.4 was November 28, 2022.
Developers who are still utilizing PHP versions older than 8.1 ought to update. PHP 8.3, the most recent version, was made available on November 23, 2023, and will continue to receive security and active support through 2026 and 2025, respectively.
The new features and changes in PHP 8.3 include:
- Typed class constants: You can now declare the type of a class constant explicitly, instead of relying on the inferred value. This can help prevent errors and improve readability.
- Dynamic class constant and enum member fetch support: You can now use a variable to access a class constant or an enum member, instead of using the constant() function. This can make the code more concise and expressive.
- json_validate() function: You can now use this function to check if a string is a valid JSON format, without decoding it. This can be useful for validating JSON input or output.
- Random extension additions: The random extension has been improved with new methods and classes, such as Randomizer::getBytesFromString(), Randomizer::getFloat(), and Randomizer::nextFloat(). These can help you generate random bytes, floats, and integers with more flexibility and control.
- Addition of mb_str_pad(): You can now use this function to pad a multibyte string to a certain length with another string. This can be useful for formatting or aligning multibyte text.
- Addition of #[\Override] attribute: You can now use this attribute to mark a method that overrides a parent method or an interface method. This can help you avoid typos and make the code more clear and consistent.
- Deep-cloning of readonly properties: You can now modify readonly properties once within the __clone() method, to enable deep-cloning of readonly objects. This can help you create copies of objects with complex state.
Upgrading to PHP 8.3 is not only a matter of security and compatibility but also a matter of performance and innovation. PHP 8.3 is faster, more reliable, and more expressive and enables developers to write cleaner and more efficient code.
Websites that use PHP 8.0 or earlier should upgrade as soon as possible to avoid potential issues and to enjoy the benefits of the latest version.
You can find out more about PHP 8.3 here.