?? ' ' operator in php laravel code example
Example: ?? ' ' operator in php laravel
// 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';
}