# RFC: Namespace declaration with leading backslash

- Thread: https://externals.io/message/42658
- Original archive: https://news-web.php.net/php.internals/42658
- Started by Bernhard Schmalhofer on 2009-01-16T12:38:31+00:00
- Messages: 1
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #42658 — Bernhard Schmalhofer — 2009-01-16T12:38:31+00:00

URL: https://externals.io/message/42658#42658

Hi,

I was looking at namespaces in PHP 5.3, 
http://de3.php.net/manual/en/language.namespaces.definition.php.
There I found myself wondering  why a leading backslash in namespace 
declaration
is not allowed. For example:

<?php

namespace \A {
  echo "in namespace \\A\n";
}

?>


I image that a trailing backslash could become a common programming error,
especially as it is required when refering to symbols with their 
absolute name.

<?php

namespace A {
     const FOO = "This is FOO in namespace \\A\n";
}

namespace B {
     echo \A\FOO;
}

?>

Best regards,
   Bernhard Schmalhofer
