The Elvis operator
There's some extra whitespace, but that syntax is commonly known as the elvis operator.
Consider the following:
$result = ($this ?: $that);
$result
will be $this
if $this
is truthy, otherwise it will be $that
.
Therefore when doing the equivalent of:
echo (true ?: 'some-test');
The result is always:
echo true;
Or the string "1".
Whitespace is not equivalent to null
Note that this:
$var = (true ? : 'some-test');
is not equivalent to:
$var = (true ? null : 'some-test');
Only in the latter example will $var
be null as it's a standard ternary if statement; the first statement is a huge-quiffed elvis operator.