Benjamin Schulz wrote: > On 02.10.2007, at 22:04, Stanislav Malyshev wrote: > > >>> <?php >>> import ::Exception as Notused; >>> import Foo::Exception; >>> ?> >>> >> >> I wouldn't actually recommend using such code. If you have >> Foo::Exception just use Foo::Exception - it's short enough :) >> > > And what if not? "throw App::package::subpackage::Exception" in a file > that has the namespace "App::package::subpackage" is just wrong, > importing the Exception as a different name as well. Importing the > global Exception as something else - i don't even know what to answer to > that ... this problem makes the whole concept just seem broken, is there > even a concept? ;) > > regards, > Benjamin
<?php namespace test; class Exception {} $a = new Exception('hi'); ?> The above code works just fine. Yes there is a concept. import is best used within a namespace. So, namespace your code and there is no need to import global classes. Greg -- PHP Internals - PHP Runtime Development Mailing List To unsubscribe, visit: http://www.php.net/unsub.php