title: Importing classes and namespaces in PHP: What difference does a leading backslash make?
body: <p>What's the difference between those two:</p>
  
  <pre><code>use Exception;
  use \Exception;
  </code></pre>
  
  <p>Or those:</p>
  
  <pre><code>use Foo\Bar;
  use \Foo\Bar;
  </code></pre>
  
  <p>The <a href="http://www.php.net/manual/en/language.namespaces.importing.php" rel="noreferrer">manual</a> says:</p>
  
  <blockquote>
    <p>Note that for namespaced names (fully
    qualified namespace names containing
    namespace separator, such as Foo\Bar
    as opposed to global names that do
    not, such as FooBar), the leading
    backslash is unnecessary and not
    allowed, as import names must be fully
    qualified, and are not processed
    relative to the current namespace.</p>
  </blockquote>
  
  <p>But I don't really understand this, as all of the above variants work, i.e. it definitely is not "not allowed".</p>
  
  <p>A look into <code>zend_do_use</code> showed, that <code>is_global</code> (set, when there is a leading backslash) is only used for a warning in the following case:</p>
  
  <pre><code>namespace {
      use Exception;
  }
  </code></pre>
  
  <p>Which tells me: "The use statement with non-compound name 'Exception' has no effect". (Though doing the same with <code>use \Exception</code> would have just as little effect, but does not throw a warning.)</p>
  
  <p>So: Am I missing something? Is there actually some difference?</p>