As I know we can't redefine a constant in PHP. So if I do:
define("DEVELOPMENT", true);
theoretical I can not redefine it using:
define("DEVELOPMENT", false); (or) const DEVELOPMENT = false;
The problem is PHP let me do that. It lets me redefining a constant without throwing any error. Display error is on (I got any other error):
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL & ~E_WARNING & ~E_NOTICE & ~E_STRICT & ~E_DEPRECATED);
What to do so constants can't be redefined and to get error if I try?
My PHP version is 7.2.17
To report all php error
To report all php errors except notices
And in your case, you are redefining a constant that has been already defined show PHP throws a notice. By using
You are telling PHP not to report any kind of notices or warnings. You should remove them.
To get all warning and notices use
Fore more information refer to the official doc, and have a look on examples.