News Feed
Sections




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

Lorna Mitchell's Blog:
3 Ways to Access a Namespaced PHP Class
November 29, 2010 @ 12:49:36

Lorna Mitchell has posted three different ways you can use to get access to a namespaced class in a PHP 5.3 application, all useful depending on where you are in the application and your needs.

After what felt like years of debate over the notation to use for PHP's namespaces, it seems like the feature itself has had relatively little use or attention since it was actually implemented in PHP 5.3. We're all used to working without it but using it does make code neater.

Her three options are:

  • Refer Namespace and Class Name
  • Import the Namespace
  • Alias the Namespace and/or Class

You can find out more about namespaces in PHP applications on the PHP manual.

0 comments voice your opinion now!
namespace access method example import alias class


blog comments powered by Disqus

Similar Posts

Knut Urdalen's Blog: Yii Framework 1.0 released!

Phil Sturgeon's Blog: CodeIgniter Base Classes: Keeping it DRY

Content With Style: buggy behaviour of parent:: in PHP 5.3.3

Community News: Namespaces in PHP6

Fabien Potencier's Blog: Create your own framework... on top of the Symfony2 Components (part 7)


Community Events





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


introduction testing refactor community release series interview code developer podcast opinion api laravel language symfony2 threedevsandamaybe install list framework unittest

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