php常量数学运算

Soh*_*sai 2 php constants

目前我正在学习php。我很困惑这是我的 php 代码

class OBJECT_ENUM
{
    const USER = 10;
    const POST = 30;
    const SECURE_REQUEST = 40;
}

class OPERATION_ENUM
{
    const INSERT_USER = OBJECT_ENUM::USER + 1; // <- here it gives an error
    const SEND_MAIL = OBJECT_ENUM::USER + 2;

    const LIKE_POST = OBJECT_ENUM::POST + 1;
    const INSERT_POST = OBJECT_ENUM::POST + 2;

    const ENCRYPT = OBJECT_ENUM::SECURE_REQUEST + 1;
}

error message: 
Parse error: syntax error, unexpected '+', expecting ',' or ';' in /var/www/workspace/6thAssignment/include/tempCall.php on line 15
Run Code Online (Sandbox Code Playgroud)

我只是不明白为什么会出现这个错误。?有人能给我解释一下吗??

先感谢您

Mic*_*bov 5

原答案:

正如您在http://www.php.net/manual/en/language.oop5.constants.php中看到的:

该值必须是常量表达式,而不是(例如)变量、属性、数学运算的结果或函数调用。

更新:

从 PHP 5.6 版开始,现在可以在常量中使用表达式。