📜  在 php 代码示例中使用三元运算符作为空值合并运算符

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

代码示例1
 null);

print $b['a'] ?? 'd'; // d
print "\n";

print $b['a'] ?: 'd'; // d
print "\n";

print $b['c'] ?? 'e'; // e
print "\n";

print $b['c'] ?: 'e'; // Notice: Undefined index: c in /in/apAIb on line 33
print "\n";