PHP 7 Null Coalescing Operator

Null coalescing operator (??) has been introduced in PHP 7.This is replacement of ternary operator in conjunction with isset() function.It (??) returns its first operand if it exists and not NULL; otherwise it returns its second operand.


$varible = $a ?? $b; // return value of $a if it exist and not null.
//  if $_GET['salary'] does not exist.It will return 100000.
$salary = $_GET['salary'] ?? '100000';
// This is equivalent to:
$salary = isset($_GET['salary']) ? $_GET['salary'] : '100000';