TIL: What does double question marks mean in PHP?

Today I learned about the double question mark operator introduced in PHP7.

You can use it instead of a if condition like

if (isset($array['key'])) {
  $value = $attributes['name'];
} else {
  $value = '';

and instead write

$value = $array['key'] ?? ''

Leave a Reply

Your email address will not be published. Required fields are marked *