Home »
MCQs »
PHP MCQs
Which PHP operator known as 'Null coalescing' operator?
85. Which PHP operator known as "Null coalescing" operator?
- ?
- ?=>
- ??
- ???
Answer: C) ??
Explanation:
The PHP operator ?? is known as "Null coalescing" operator. The syntax is:
$value = expression1 ?? expression2
It returns the value of $value. The value of $value is expression1 if expression1 exists, and is not NULL. If expression1 does not exist, or is NULL, the value of $value is expression2.
The Null coalescing operator (??) was introduced in PHP 7.