php define reports an error because it is wrong to make constants case-insensitive by defining true. The solution is to discard true as the third parameter of define().
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
How to solve the php define error problem?
define() method reports an error after defining ture
In PHP, usually we can use the define() method to define constants, and we can also pass Define the third variable as true or false to define whether the constant is case-sensitive, for example,
define('WEB','555',true); echo web; //555 echo WEB; //555
But when I finished editing and running, I did not get the desired result. The running result is as shown
Errors are reported in the second and third lines respectively, but you can see the running results. I will translate the error message:
It is not recommended to use: define() : Declaration of case-insensitive constants is deprecated
Deprecated: Case-insensitive constants are deprecated. The correct case for this constant is "WEB".
At the same time, we also found that there was no error in the fourth line of code.
Obviously our approach of making constants case-insensitive by defining true is wrong, because case-insensitive constants are deprecated in PHP7.3,
PHP 7.3: Deprecated Use true as the third parameter of define().
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to solve php define error problem. For more information, please follow other related articles on the PHP Chinese website!