Last updated on January 30, 2021
The null coalescing assignment operator is a shorthand for null coalescing operations.
Let’s take a example code
$data['date'] = $data['date'] ?? new DateTime();
So, instead of writing the previous code, we could write the following:
$data['date'] ??= new DateTime();
If the value of the left-hand parameter is null, then the value of the right-hand parameter is used.