Exciting new features of PHP 8.1

PHP’s latest and greatest version, PHP 8.1, has been released yesterday, i.e 25th November, 2021. So, I created this little page where I have covered all the articles on all the hot new features of PHP 8.1.

Readonly properties are coming in PHP 8.1

— PHP, as a language, is ever-changing and ever-evolving. It’s not a language it was 10 years ago. This is all because the PHP’s core team which has been constantly improving minor things that might not look significant at first glance but when fixed/implemented, can dramatically improve the overall developer experience.

Native enumerations (enums) are coming in PHP 8.1

— Enums or enumerations or enumerator types are those little data structures that can be used to define a set of named values. More like constants. For instance, a contract status which can be “permanent”, “temp”, or “apprentice”. Or a order status that can be “ordered”, “dispatched”, “shipped” etc.

Array unpacking with string keys coming in PHP 8.1

— The spread operator in PHP is getting more awesome in PHP 8.1! So, to give you a primer, with the release of PHP 7.4, it got possible to merge multiple arrays by unpacking arrays into another array using the spread operator.