Constants can't accept expressions that make calculations.
This is not true.
define
may accept as second parameter expressions, included values returned from a called function.
The restrictions for the value
parameter of define are (from the manual)
value
The value of the constant. In PHP 5, value must be a scalar value (integer, float, string, boolean, or NULL). In PHP 7, array values are also accepted.
Of course a constant cannot be defined twice.
And -if I understand your question- this is the "ideology" of constants.
As they are defined the value cannot be modified in another part of the script as it's constant.
Of course if the script is run a second time the constant can get a different value like in your case.
Worth mentioning this is different for Class Constants - constants you declare inside a class definition with the keyword const
.
Due to language design/specifications
The value must be a constant expression, not (for example) a variable, a property, or a function call.