试图使用这些类
class Permits
{
const PROTECTED = 0;
const CREATE = 1;
const UPDATE = 2;
const DELETE = 3;
}
class MenuPositions
{
const DEFAULT = 0;
const TOP = 1;
const SIDE = 2;
}
PHP 不发誓。到目前为止没有任何问题。
问题是——威胁是什么?=)
试图使用这些类
class Permits
{
const PROTECTED = 0;
const CREATE = 1;
const UPDATE = 2;
const DELETE = 3;
}
class MenuPositions
{
const DEFAULT = 0;
const TOP = 1;
const SIDE = 2;
}
PHP 不发誓。到目前为止没有任何问题。
问题是——威胁是什么?=)
我不明白您为什么决定在问题中包含这些常量。其中,只有and是保留字。您使用的其余常量名称在 PHP 中没有特殊的语法含义。
protected
default
在 7.0 之前,保留字会导致解析错误,因为 7.0:
可用于类属性、常量、方法名、接口和特征。除了 word
class
,它不能是常量名并且被单独的条件阻止。也就是说 - 由开发人员自行决定。手册指出,解析器将找出保留字在哪里以及常量的名称在哪里。