- Canada's Leading Web Hosting and Domain Name Provider

What’s New in PHP 8.1

PHP is so universally used that all website developers are constantly on alert for the newest version to be released. PHP 8.1 is being released this month 


This capability offers greatly expanded support for data modeling, custom type definitions, and monad-style behavior. Enums enable the modeling technique of “make invalid states unrepresentable,” which leads to more robust code with less need for exhaustive testing.

Intersection Types

PHP 8.1 will now support Intersection Types, a function that allows the setting of a type for a parameter, property, or return types and enforcing that values belong to all of the declared class/interface types. The way this works is the opposite of the PHP Union Types, which allow any of the declared types. (Union Types and Intersection Types are therefore not allowed in the same declaration.) Intersection Types are declared by combining the class/interface names with an “&” sign.


An update to the Generators added in PHP 5.4, a Fiber is a code block that maintains its own stack, that can be started, suspended, or terminated cooperatively by the main code and the Fiber. 

Never return type

Never is a new return type added in PHP 8.1. A function/method that is declared with the never return type indicates that it will never return a value, and always throws an exception or terminates with a die/exit call. Never return type is similar to the existing void return type, but the never type guarantees that the program will terminate or throw. In other words, a function/method declared never must not call return at all, even in the return; form. The goal of the never return type is to indicate and enforce a function that prevents the rest of the called code from being executed. 

As you can see, these developments get pretty technical—unless you’re a developer, they probably won’t mean that much to you. With a CanSpace hosting plan, we always ensure that our clients have the latest version of PHP available to them at all times. To find out more about this specific update, visit the PHP site. And if you have any specific questions about how these new functionalities may affect your site, contact us to discuss!

CanSpace Team

CanSpace Solutions is Canada's leading domain name registrar and web hosting provider. Keep an eye on our blog for expert information on domain names, websites, and running a business online.