Why doesn't PHP permit private const?

前端 未结 2 965
心在旅途
心在旅途 2020-12-05 12:51

I have a class that benefits from the use of constants in its internal implementation, but I would like to limit visibility of these constants. Why doesn\'t PHP permit priva

2条回答
  •  情深已故
    2020-12-05 13:18

    As of PHP 7.1, there are real private constants.

    private const PRIVATE_CONST = 0;
    

    See the Class Constant Visibility RFC for more information.

提交回复
热议问题