The official PHP manual says, "Once a constant is defined, it cannot be changed or undefined."
But why can this kind of value change be defined in the program?
<code>define("MESSAGE", time()); //输出常量 echo MESSAGE;</code>
The official PHP manual says, "Once a constant is defined, it cannot be changed or undefined."
But why can this kind of value change be defined in the program?
<code>define("MESSAGE", time()); //输出常量 echo MESSAGE;</code>
From a grammatical point of view, this is not wrong. The changes mentioned in the manual emphasize the later human changes, including cancellation.
The MESSAGE you want to express here is variable, which can be understood as the result of PHP itself finding time() in the memory during operation.
I guess, this should have something to do with functional programming. The time() function can be assigned to a constant. Accessing the constant is equivalent to accessing the time() function, and the return value of the time() function is constantly changing.
Once a constant is defined, it cannot be changed or undefined
Then you can try changing MESSAGE,
For example, MESSAGE += 1;
It feels like this is establishing a connection to the time() function!