Nice features in PHP8.x

21. Dezember 2022PHP

PHP 8 includes several new features and improvements that make the language more efficient, secure, and developer-friendly. Here are some of the notable features in PHP 8.x.

New in 8.0: https://www.php.net/releases/8.0/en.php
New in 8.1: https://www.php.net/releases/8.1/en.php

Some examples

match() instead of switch()

https://www.php.net/manual/de/control-structures.match.php

Nullsafe operator

https://www.php.net/releases/8.0/en.php#nullsafe-operator

?? instead of isset()

array['x']['y'] ?? false
is short for
isset(array['x']) && isset(array['x']['y'])