News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Derick Rethans' Blog:
Namespaces in PHP
June 16, 2008 @ 07:54:39

After hearing Stefan Priebsch's talk at this year's Dutch PHP Conference, something occurred to Derick Rethans - there was a small sort of issue with using namespaces and possible future PHP's own namespace.

One of the things that came up is the conflicts that can arise with internal classes. In PHP 5.3 this would alias the class Interval in the namespace PEAR::Date to the class Interval. For now, this code would work just fine. However, if PHP would introduce a class "Interval" at some point in the future (and PHP can do this as it owns the global namespace) then the above code would suddenly stop working

He offers a simple solution that can prevent this sort of conflict for the future - defining your "use" and then creating a new instance of the namespace into a variable instead of just an "as".

0 comments voice your opinion now!
namespace problem global implement future use conflict


blog comments powered by Disqus

Similar Posts

PHPMaster.com: Reusing Implementation - a Walk-through of Inheritance, Composition, and Delegation

Tony Bibbs' Blog: Oh So Familiar Problem with Zend Studio Neon (Eclipse-based)

Timothy Boronczyk's Blog: Evil Access (a Database Class)

Till's Blog: Avoiding common pitfalls with Zend_Test

Sean Coates' Blog: Actually Solving a Problem (believe it or not)


Community Events

Don't see your event here?
Let us know!


voicesoftheelephpant introduction extension development opinion laravel api library series interview framework laravel5 conference psr7 language podcast release video unittest community

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework