📜  ?? ' ' php laravel 中的运算符 - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:04.400000             🧑  作者: Mango

代码示例1
// 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';
}