Hi Derick,

Your example will work fine.

I made a mistake in my sentence. I meant not "multiple files in namespace"
but "multiple namespaces in file".

Proposed concept allows multiple files in namespace but not multiple
namespaces in file.

Thanks. Dmitry.

> -----Original Message-----
> From: Derick Rethans [mailto:[EMAIL PROTECTED] 
> Sent: Monday, July 09, 2007 10:38 PM
> To: Dmitry Stogov
> Cc: 'Larry Garfield'; internals@lists.php.net
> Subject: RE: [PHP-DEV] Simple Namespace Proposal
> 
> 
> On Sun, 8 Jul 2007, Dmitry Stogov wrote:
> 
> > Note that multiple files in namespace won't allow autoloading.
> 
> That got me confused a bit. I was wondering whether the 
> following would 
> work (with autoload):
> 
> 
> In file "a/b.php":
> 
> <?php
> namespace a;
> class b { }
> ?>
> 
> in file "a/c.php":
> 
> <?php
> namespace a;
> class c { }
> ?>
> 
> In file "a/d.php":
> 
> <?php
> namespace a;
> class d { }
> ?>
> 
> in file "a/e.php":
> 
> <?php
> namespace a;
> class e { }
> ?>
> 
> 
> 
> in "index.php":
> 
> <?php
> function __autoload( $className )
> {
>       include str_replace( "::", "/", $className ) . ".php";
> }
> 
> $b = new a::b;
> $c = new a::c;
> 
> import a;
> 
> $d = new d;
> $e = new e;
> 
> ?>
> 
> 
> regards,
> Derick
> 
> -- 
> Derick Rethans
> http://derickrethans.nl | http://ez.no | http://xdebug.org
> 

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to