PHP 8 Has Just Been Released

By December 7, 2020 No Comments

We all know PHP. It is one of the most popular programming languages out there. It is a powerful and widely accessible programming language, commonly known as the language WordPress uses. PHP 8 has just been released, the new version promising even more power and speed than ever before.

So what has PHP 8 changed?

  • Faster Code Execution: PHP 8 has a compiler built-in, which is the first since PHP started. This compiler is known as JIT and it will cache your interpreted code and generate a machine code as an output. This will create speed improvements for complex tasks and algorithms, opening the PHP language to several new opportunities.
  • Code with Higher Quality: PHP 8 will now start being classified as code exceptions or errors, allowing you to catch and log these warnings. This is a major improvement and will allow many websites to keep better track of their users errors. It is possible that many websites will notice problems that otherwise would have remained unknown. Allowing major fixes and an improvement to the website experience overall.
  • Cleaner, Shorter Code: The new PHP 8 will have cleaner and shorter code. Some elements, including the null safe operator, will greatly improve the readability of code by shortening and neatening this code. The null safe operator adds functionality to PHP 8 that otherwise wouldn’t have existed. When writing “if statements” in your code you can now use the null operator to write all of those codes in one. This will shorten several lines of code and make it that much easier to read.
  • The “Union Type” Trend: Prior to PHP 8, you could only declare a single type for properties, parameters, and return types. In PHP 8 you can now add “union types” that are a collection of two or more types which tell the browser that either one can be used. This basically creates a condition where either this OR this type can be used.