#PHP 7 has added a new operator double question mark (??) operator. In PHP 7, the double question mark (??) operator is called the Null Coalescing operator.
If the first operand exists and is not NULL, return the first operand; otherwise, return the second operand. It is evaluated from left to right. The Null Coalescing operator can also be used in chained format.
Let us demonstrate the double question mark (??) operator with the following example.
<?php //$a is not set echo $a ?? 9 ??45; ?>
9
<?php //$a is not set $b = 34; echo $a ?? $b ?? 7; ?>
34
The above is the detailed content of In PHP, what does the double question mark (??) operator mean?. For more information, please follow other related articles on the PHP Chinese website!