Which PHP operator known as 'Null coalescing' operator?

85. Which PHP operator known as "Null coalescing" operator?

  1. ?
  2. ?=>
  3. ??
  4. ???

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.

Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.