# Autoload and namespaces

- Thread: https://externals.io/message/42108
- Original archive: https://news-web.php.net/php.internals/42108
- Started by Tony Bibbs on 2008-12-04T22:26:36+00:00
- Messages: 2
- 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

---

## #42108 — Tony Bibbs — 2008-12-04T22:26:36+00:00

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

Given this:

use \MyProject\SubProjectA as A;

A\foo::someMethod();

The className given is to the autoload function is
"MyProject\SubProjectA\foo" not "\MyProject\SubProjectA\foo" (notice lack of
leading \)

I just wanted to verify that behaves as intended (which I'm guessing it
does).

-- 
Tony Bibbs
Email: tony@tonybibbs.com Phone: 515.554.8046
Twitter: tonybibbs Skype: tonybibbs
Web: http://www.tonybibbs.com

---

## #42110 — Greg Beaver — 2008-12-05T06:14:36+00:00

URL: https://externals.io/message/42108#42110 · In reply to: #42108

Tony Bibbs wrote:
> Given this:
> 
> use \MyProject\SubProjectA as A;
> 
> A\foo::someMethod();
> 
> The className given is to the autoload function is
> "MyProject\SubProjectA\foo" not "\MyProject\SubProjectA\foo" (notice lack of
> leading \)
> 
> I just wanted to verify that behaves as intended (which I'm guessing it
> does).

Yes.  This is probably a good item to add to the FAQ.

Greg
