Pages tagged php5_3:

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, there is increased risk of accidentally re-defining a function or class name that has been declared before. The problem is exacerbated when you attempt to add third-party components or plugins; what if two or more code sets implement a ‘Database’ or ‘User’ class? Until now, the only solution has been long class/function names. For example, WordPress prefixes every name with ‘WP_’. The Zend Framework uses a highly descriptive naming convention that results in long-winded class names such as Zend_Search_Lucene_Analysis_Analyzer_Common_Text_CaseInsensitive. Name collision problems can be solved with namespaces. PHP constants, classes, and functions can be grouped into namespaced libraries.
** Posted using Viigo: Mobile RSS, Sports, Current Events and more **
Internationalization in PHP 5.3