FANDOM


NamespaceEdit

  • use backslash, instead of "." as Java, to separate namespace levels
  • global namespace "\"
PHP Java

Simple format:

namespace MyNameSpace\subns;
// class declaration ...

Bracket format:

namespace MyNameSpace2 {
// class declaration ...
}

Global namespace:

namespace {
// class declaration ...
}
  • applicable to class, function and constant
package MyNameSpace.subns;

Import or aliasing namespace:

use MyNameSpace\subns as SubLevel;
SubLevel/func1();

use MyNameSpace\subns;
subns/func1()
import MyNameSpace.subns.*;

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.