background preloader

PHP

Facebook Twitter

Drupal

Listing. How to Use PHP Namespaces, Part 1: The Basics. Namespaces are one of the most significant changes in PHP 5.3. They will be familiar to C# and Java developers, and they are likely to change the structure of PHP applications for the better. Why Do We Need Namespaces? As the size of your PHP code library increases, the more likely you will accidentally reuse a function or class name that has been declared before.

The problem is exacerbated if you attempt to add third-party components or plugins; what if two or more code sets implement a ‘Database’ class?