What is use of Null Coalesce Operator?

Technology CommunityCategory: PHPWhat is use of Null Coalesce Operator?
VietMX Staff asked 4 years ago

Null coalescing operator returns its first operand if it exists and is not NULL. Otherwise it returns its second operand.

Example:

$name = $firstName ?? $username ?? $placeholder ?? "Guest";