title: Namespace constants and use as
body: <p>I'm having some problems with using constants from a namespace.  If I define the constant and try to use as it, PHP seems unable to find it.  For example, in my file with the constants I have code along the lines of the following: </p>
  
  <pre><code>namespace \my\namespace\for\constants;
  
  const DS = DIRECTORY_SEPARATOR;
  </code></pre>
  
  <p>Then in the consuming file I have: </p>
  
  <pre><code>namespace \some\other\namespace;
  
  use \my\namespace\for\constants\DS as DS;
  
  echo (realpath (DS . 'usr' . DS 'local'));
  </code></pre>
  
  <p>However, instead of echoing '/usr/local' as expected I get the following notice and an empty string.  </p>
  
  <blockquote>
    <p>Notice: Use of undefined constant DS - assumed 'DS' </p>
  </blockquote>
  
  <p>If I change the code as follows: </p>
  
  <pre><code>use \my\namespace\for\constants as cns;
  
  echo (realpath (cns\DS . 'usr' . cns\DS 'local'));
  </code></pre>
  
  <p>I get the expected result, but it's obviously quite a bit less convenient than just being able to pull the constants in directly.  </p>
  
  <p>You can alias a class/interface/trait in a namespace, are you not able to alias a constant too?  If you can do it, then how?  </p>