While most regular developers were enjoying time off with their families, the PHP dev team worked their best to bring new minor version of PHP with quite a few nice and useful features.
Everybody who follows the news of PHP world has already been excited about 7.4 for months, here’s a brief list of most important changes for those who missed it:
- Typed Properties
public string $name;
- Arrow Functions
fn($x) => x * 2
- Type Covariance and Contravariance
- Null coalescing assignment operator
$array['key'] ??= computeDefault()
- Unpacking Inside Arrays
['val1', 'val2', ...$val3to5, 'val6']
- Opcache Preloading
- Custom object serialization (
- A few Deprecated Features (they had it coming)
See the complete PHP 7.4 migration guide for details.
Besides the major improvements, there’s a minor one I feel strongly about: nested ternary operators with parentheses missing are now deprecated. I’m glad to see them thrown out of the door, it’s about time people stop using them.