PHP short-ternary (“Elvis”) operator vs null coalescing operator
Elvis ?: returns the first argument if it contains a “true-ish” value (see which values are considered loosely equal to true in the first line of the Loose comparisons with == table). Or the second argument otherwise $result = $var ?: ‘default’; // is a shorthand for $result = $var ? $var : ‘default’; Null … Read more