I am using PHP 8.1. I have defined a MY_CONSTANT constant and I want to check if it is available.
Instead of isset() I am using the intended function defined().
if (defined(MY_CONSTANT) && is_array(MY_CONSTANT)) {
// do stuff
}
The constant MY_CONSTANT is an array and I get the following error:
defined(): Argument #1 ($constant_name) must be of type string, array given
I don’t understand why PHP expects a value of type string when I just want to check the availability of the constant, not its type.