PHP 8: New features and updates
PHP 8 is now live - here's what's new.
![Security Researcher](https://cdn.mos.cms.futurecdn.net/tW3bQkGAUNN76QgZ4aYbVk-320-80.jpg)
PHP is a powerful, and widely accessible, open-source programming language that is primarily used in website development. Even though we constantly see a rise in all sorts of different technologies and website-building software, PHP remains one of the most widely used languages, powering a staggering number of websites. The new version, PHP 8, promises to bring even more power and speed allowing for even better results.
Unlike something like JavaScript, which is client-side, PHP is server-side. When the browser requests information from the server, the server executes the code and sends the result to the client. The browser then uses this information to create a web page. PHP is relatively easy to learn, fast, and compatible with almost all browsers making it a powerful tool for developers of all kinds.
- Here's our list of the best web development tools right now
- Check our our list of the best text editors available
- We've built a list of the best mobile app development software
Hristo Pandjarov is WordPress Initiatives Manager at SiteGround
What are the PHP 8 improvements and features?
PHP 8 went live on November 26 and will introduce a lot of improvements in speed, security and cleanness of code:
Faster Code Execution: PHP 8 is the first PHP version that has a compiler – JIT – that caches your interpreted code and generates a machine code as an output. The JIT, or “just in time” compiler promises speed improvements for complex tasks and algorithms and opens new opportunities for the PHP language to broaden its reach and applications.
Code with Higher Quality: One of the major differences you will notice with PHP 8 is that many of the warnings and notices that were hard to catch are now classified as code exceptions or errors, which can be caught and logged. It is possible that due to this update, a lot of problems that remained hidden as notices with the previous PHP versions will now surface.
Cleaner, Shorter Code: Some of the new elements, such as the null safe operator, greatly improve the readability of the code, making it shorter and neater. The null safe operator provides functionality similar to null coalescing, but also supports method calls. Instead of nesting several “if statements” you can use the “null” operator to write all those in just 1 line of code.
The “Union Type” Trend: In versions prior to PHP 8.0, you could only declare a single type for properties, parameters, and return types. In this latest release, there is a feature called “union types” that are a collection of two or more types which indicate that either one of those can be used. A union type essentially declares an OR condition for multiple types in the argument type, return type or property type declaration.
Are you a pro? Subscribe to our newsletter
Sign up to the TechRadar Pro newsletter to get all the top news, opinion, features and guidance your business needs to succeed!
The release candidate version has been available for testing for a while now. Most quality website hosting companies should already have an option for developers to test it on their platform. Since major versions often include changes that might break backward compatibility, it's better to test the release candidate version as early as possible, and prepare your code if you want to get all the benefits of the latest update.
Keeping up with the latest PHP versions is essential if you want to have fast and secure code. PHP 8 is a major and highly anticipated update, but before upgrading, it is strongly recommended to test it on a Staging version of your website first, in order to fix any incompatibility or errors in advance. For more information on the new features and other changes, you can read the NEWS file, or the UPGRADING file for a complete list of upgrading notes.
- Here's our list of the best laptops for programmers right now
Hristo Pandjarov is WordPress Initiatives Manager at SiteGround