Hacker News new | ask | show | jobs
by Geee 2716 days ago
The null coalescing operator ?? is not well explained. It returns the first operand but if it's not set or null, will return the second operand, i.e:

    $name = $_GET['name'] ?? $_POST['name'] ?? "unknown";
In the arrays section, I'd also introduce the $array[] shorthand for array_push(), i.e:

    $array[] = $new_element;