Beginner PHP
Q20 / 100

What does PHP's null coalescing operator ?? do?

Correct! Well done.

Incorrect.

The correct answer is B) Returns the left operand if it exists and is not null; otherwise returns the right operand

B

Correct Answer

Returns the left operand if it exists and is not null; otherwise returns the right operand

Explanation

$name = $_GET['name'] ?? 'Anonymous' returns $_GET['name'] if set, otherwise 'Anonymous'. Added in PHP 7.

Progress
20/100