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?
}
}