I know this is probably a newbie question, but is it possible to do this?
unserialize(LOG_ACTIONS_.''.strtoupper($language));
I have list of constants with _LANGUAGE which I want to use the variable $language with.
Example:
unserialize(LOG_ACTIONS_ENGLISH);
Here’s the error I get:
Fatal error: Call to undefined function LOG_ACTIONS_strtoupper()
Use
constant()to get the constant’s actual value.I’m not sure whether having serialized data in a constant is really wise, though – it can be expensive if there’s a lot of data in them.
I assume it’s to circumvent the restriction that constants can’t contain array values. This SO question shows some better ways to work around that:
What is the most "elegant" way to define a global constant array in PHP