php null coalesce
snippet in php

php null coalesce

user129

// if $_POST['name'] doesn't exist $result will equal to John
$result = $_POST['name'] ?? 'John';

null collapse operator php

user5652

        $name = $_GET['name'] ?? $user_name ?: 'anonymous';