Suppose I have a top-level namespace \Outer
and I have another sub-namespace \Outer\Inner
and I have another top-level namespace \Inner
and in a class in \Outer I use Inner like this
use Inner;
then which Inner will be used?
\Outer\Inner // ( sub-namespace )
or the
\Inner // ( top-level namespace )
I am confused because php said that the \ was optional for top-level namespaces?
When you have namespace
\Outerin a class, thenuse Inneris going to be usingInnertop-level namespace. If you want to use subnamespace you should use\Outer\InnerAs stated in php using namespaces
Lets say your first file was: