How can I check if a constant is defined in a PHP class?
class Foo { const BAR = 1; }
Is there something like property_exists()
property_exists()
Yes, just use the class name in front of the constant name:
defined('SomeNamespace\SomeClass::CHECKED_CONSTANT');
http://www.php.net/manual/en/function.defined.php#106287