1. Home
  2. Php
  3. Null coalescing operator

Null coalescing returns the first value if it exists and is not null, otherwise it falls back to the second value.

#php#conditional
$colour = "red";
echo $colour ?? "blue"; // returns "red"
copy
Full Php cheatsheet