Question : ?? ' ' operator in php laravel
Answered by : shahzad-mahota
// Null Coalesce Operator in PHP (Laravel) - $statement ?? ''
$categoryName = $category->name ?? 'Not Available';
// The above Statement is identical to this if/else statement
if (isset($category->name)) { $categoryName = $category->name;
} else { $categoryName = 'Not Available';
}
Source : | Last Update : Tue, 23 Feb 21