PHP cannot delete constants, reasons: 1. When assigning a constant to a variable, it actually assigns a value, but it is still a constant; 2. Once a constant is defined, it cannot be replaced
#php cannot delete constants, only variables.
Assigning a constant to a variable is actually assigning a value, but it is still a constant.
All constants cannot be deleted.
And the constants you define cannot be changed, they are fixed.
Evidence:define defines a constant define(constant name, value);
Proof 1: The constant cannot be deleted
Execution result: Syntax Error
Parse error: syntax error, unexpected ')', expecting T_PAAMAYIM_NEKUDOTAYIM in C:\wamp\www\Untitled-1.php on line 11
Certificate 2: Once a constant is defined, it cannot be replaced
Result: (Error message: Note that abc is already a constant.)
abc Notice: Constant abc already defined in C:\wamp\www\Untitled-1.php on line 12 abc
';//空白 $abc='我是变量'; ecoh $abc; ?>
Use directly $ defines all variables.
Relevant learning recommendations:php graphic tutorial
The above is the detailed content of Can php delete constants?. For more information, please follow other related articles on the PHP Chinese website!