title: Check if a class constant exists
body: <p>How can I check if a constant is defined in a PHP class?</p>
  
  <pre><code>class Foo {
      const BAR = 1;
  }
  </code></pre>
  
  <p>Is there something like <code>property_exists()</code> or <code>method_exists()</code> for class constants? Or can I just use <code>defined("Foo::BAR")</code>?</p>