2
就像在C++中一样,可以在构造函数中初始化类常量吗?在构造函数中初始化类常量在PHP中
到C++类似它会看起来像:
class Abc
{
const WIDTH;
public __constructor($width):WIDTH($width) //WIDTH gets assigned here and is immutable
{
//I know syntax may not be ok but is anything similar possible in PHP?
}
}