null coalescing chaining operator php code example
Example: null coalescing operator php
// The null coalescing operator (??) is used to replace the ternary operation
// in conjunction with isset() function and returns its first operand if it
// exists and is NOT NULL; otherwise it returns its second operand.
$username = $_GET['username'] ?? 'not passed';
// Equivalent code using ternary operator
$username = isset($_GET['username']) ? $_GET['username'] : 'not passed';