PHP Namespaces
PHP Namespaces
Namespaces are qualifiers that solve two different problems:
- Namespaces allow for better organization by grouping classes that work together to perform a task
- Namespaces allow the same name to be used for more than one class
Declaring a Namespace
Namespaces are declared at the beginning of a file using the namespace keyword:
Syntax
namespace Html;
Example
Create a Table class in the Html namespace: