null and isset

isset and ??.

isset asks if a key exists. ?? fills a default.

Goal

Echo a missing note as none.

<?php
$row = ["city" => "Nairobi"];
echo isset($row["note"]) ? "yes" : "no", PHP_EOL;
<?php
$note = null;
echo $note ?? "none", PHP_EOL;
<?php
$row = ["city" => "Kisumu", "units" => 5];
echo $row["note"] ?? "none", PHP_EOL;
<?php
$missing = null;
echo is_null($missing) ? "null" : "set", PHP_EOL;