rfc:spl-namespace

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
rfc:spl-namespace [2008/07/21 14:56] – removed an unnecessary comment baptiste750rfc:spl-namespace [2008/07/21 15:23] baptiste750
Line 59: Line 59:
  
 <code php> <code php>
-spl_autoload_register(array('Foo1::Foo2::Autoloader''autoload'));+spl_namespace("Foo1::Foo2", "some/where"); 
 +(...) 
 +spl_autoload_register(array("Foo1::Foo2::Autoloader""autoload"));
 // When Foo1::Foo2::Autoloader::autoload() is called, PHP has CD to /some/where  // When Foo1::Foo2::Autoloader::autoload() is called, PHP has CD to /some/where 
 </code> </code>
 +
 +In the example above, every class succesfully autoloaded by ''Foo1::Foo2::Autoloader'' will be prefixed by ''Foo1::Foo2::'', as well as all the code inside that class.
  
 ==== Benefits ==== ==== Benefits ====
Line 86: Line 90:
 ==== Drawbacks  ==== ==== Drawbacks  ====
  
-  * ...+  * If an autoloader, for a given classname, includes a different file depending on the value of a global variable, there's no longer unicity
  
   * ...   * ...
rfc/spl-namespace.txt · Last modified: 2017/09/22 13:28 by 127.0.0.1