Namespaces
Namespaces can be used to group classes or functions for convenience.
Example 14: Namespaces
<?php
namespace Math {
class
Complex {
//...code...
function __construct() {
print("hey");
}
}
}
$m = new Math::Complex();
?>
Note how namespaces can be used to qualify the class that should be created. As a practical example
you may want to declare the same class name in different namespaces to do different things (but
with the same interface).
you may want to declare the same class name in different namespaces to do different things (but
with the same interface).