antnee — 2011-04-10T12:17:55-04:00 — #1
Is it possible to create objects in one namespace from another?
For example, if I am in the global namespace and I want to create an object in the config namespace, can I do it, and if so how?
The obvious appears to be something like this to me:
config\\$object = new config\\class();
This isn't working for me however. Am I doing something wrong or is it just not possible?
I get this error:
Parse error: parse error, expecting `T_STRING' in...
logic_earth — 2011-04-10T23:40:02-04:00 — #2
$config = new \\config\
antnee — 2011-04-11T02:28:11-04:00 — #3
Won't that create the object in the current namespace? I'm wanting to create an object in a different namespace to the one I'm in, if possible.
logic_earth — 2011-04-11T03:13:19-04:00 — #4
variables do not exists in any namespace but the global namespace.
antnee — 2011-04-11T03:28:33-04:00 — #5
Ah, then that is the simple answer I was looking for. Cheers