?: is an abbreviation for triple operator since PHP 5.3
So ?: Looks like || in javascript in the following case:
var myVar = var1 || var2
If the value of var1 evaluates to true, myVar will be that, otherwise var2 .
Notes:
0 , '' , false and null evaluate to false, so if you have the following:
$data = 0; $this->data = $data ?: 'someVal'; echo $this->data;
As a result, you will get "someVal" .
In this case, use isset or empty .
source share