note 82087 deleted from language.oop5.autoload by aharvey

From: Date: Fri, 05 Nov 2010 19:00:54 +0000
Subject: note 82087 deleted from language.oop5.autoload by aharvey
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173798@lists.php.net to get a copy of this message
Note Submitter: richard at richard-sumilang dot com ---- [ >= php5.3] If you are using namespaces and this is MyClass.php: <?php namespace com::richardsumilang::utils; class MyClass{ // ... code ... } ?> And say we are using MyClass in another file like so... <?php use com::richardsumilang::utils as Utils; $foo=new Utils::MyClass(); ?> And lastly if this was our __autoload method: <?php function __autoload($class){ echo "Trying to load: ", $class,"\n"; } ?> That will echo "com::richardsumilang::util::MyClass" and not "Utils::MyClass". It is very useful that it is passing the full name of the class and not the alias name you use so if your classes followed your directory structure then you would be ok: com::richardsumilang::utils::MyClass = com/richardsumilang/utils/MyClass.php - Richard Sumilang

« previous php.notes (#173798) next »