null collapse operator php code example
Example 1: php null coalesce
// if $_POST['name'] doesn't exist $result will equal to John
$result = $_POST['name'] ?? 'John';
Example 2: null collapse operator php
$name = $_GET['name'] ?? $user_name ?: 'anonymous';