PHP is among the most well-known and widely adopted scripting languages out there. Most notably, it has been used in far-reaching parts across web development since the early days. Hence, why there’s no shortage of buzz whenever a new update comes along, and PHP 8.1 seeks to bring quite a lot of new features and improvements to the table. This comes just one year after the release of the 8.0 update.

Its 8.1 upgrades were released earlier on the 25th of November and are ready to download now. Already, PHP 8.1 has been considered to be one of the most consequential changes to this popular language, has now expanded its capabilities even further. Among other things, the most noteworthy inclusion is its newfound support for Enums – or enumerations – that enable developers to define custom values.

What Else Do You Get?

You’ll of course get performance improvements across the board with PHP 8.1. Most excitingly though, Enums wasn’t the only new feature announced. Alongside it, PHP’s latest 8.1 updates will also support:

Read-Only Properties – Property values can’t be changed following their initialization, which is helpful for modeling value objects or performing data transfers.

First-Class Callable Syntax – You can now easily get references for any function on PHP.

Improved Initialisers – Objects can now be used as default parameters, which makes it possible for developers to use nested attributes.

Pure Intersection Types – If a value needs to satisfy numerous type constraints simultaneously, you can now use intersection types.

Never Return Type – You could use the [never] type declaration on certain functions, which will cause them to not return any values.

Final Class Constants – Declaring final class constants will ensure that data can’t be overridden.

Explicit Octal Numeral Notation – It’s not possible to write octal numbers.

Fibers – These are primitives that can be used to develop and implement lightweight concurrency.