PHP 支持这个:
$z = 5;
$str = "z is $z"; // result: "z is 5"
它支持这一点:
$c = new StdClass();
$c->x = 9;
$str = "x is {$c->x}"; // result: "x is 9"
但它不支持这一点:
class abc
{
const n = 2;
}
$str = "x is {abc::n}"; // result: "x is {abc::n}"
为什么 PHP不支持通过花括号语法插入 const?好像应该...