Disable specific notice in PHP

52 views Asked by At

I want to be able to define some custom constants using define locally which are later redeclared in the code, so the program throws Notice: Constant MY_CONSTANT already defined in....

This is for development purposes, so I want to hide that notice without hiding other notices.

If I use error_reporting(E_ALL & ~E_NOTICE); all notices would be disabled in development, which I don't want.

How can I disable only the constant already defined notices?

If it's not possible, is there any way to overwrite a constant that's declared somewhere else in the code? Currently I do it by defining my desired value before the existing one is declared, so it would use the value I set (but this shows the notices).

0

There are 0 answers