PHP 8.0 reached its end of life (EOL) on 26 November 2023 and will no longer receive any updates or patches.
PHP 8.0 was released on 26 November 2020 and brought many new features and improvements such as named arguments, attributes, constructor property promotion, match expression, nullsafe operator, JIT, and more.
The EOL of PHP 8.0 means that any websites still using it will be exposed to potential security risks and compatibility issues if they do not upgrade to a newer PHP version.
Security risks include vulnerabilities that hackers may exploit to compromise the website or its data. Compatibility issues include errors or malfunctions that may occur due to changes in the PHP language or the underlying web server software.
According to W3Techs, a version of PHP 8 is used by 19.9 percent of all the PHP-using websites whose server-side programming language they know. Of those, 45.8 percent are using PHP 8.0 specifically.
PHP 8 is the second most popular PHP version after 7, which is still used by a concerning 61.5 percent of the known websites. PHP 7.4 reached EOL on 28 November 2022.
Any developer using a version of PHP prior to 8.1 should upgrade. The latest version, PHP 8.3, was released on 23 November 2023 and will receive active support until 2025 and security support until 2026.
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.
Want to learn more about cybersecurity and the cloud from industry leaders? Check out Cyber Security & Cloud Expo taking place in Amsterdam, California, and London. The comprehensive event is co-located with Digital Transformation Week.
Explore other upcoming enterprise technology events and webinars powered by TechForge here.