Coalesce Operator¶
The coalesce operator ?? returns its first operand if it is set and not NULL. Otherwise it will return its second operand.
<?php
class X { }
// instantiation
$x = new X;
// cloning
$y = clone $x;
?>
See also Null Coalescing Operator (??) and PHP ternary operator vs null coalescing operator.
Related : Ternary Operator, Colon, If Then Else, Short Ternary Operator, Conditional Structures, Double, Nullsafe, Question Mark ?, Streamlining
Added in PHP 7.0+