Try to answer the question: what is the $obj instance of?
namespace foo;
$obj = $factory->loadClass('bar\class');
-------
$factory is implemented cca this way:
namespace ?;
class Factory
{
function loadClass($class) {
return new $class;
}
}
With absolute FQN is the answer evident. With relative FQN it is very
esoteric.
With relative FQN developers will have to implement "save" loadClass()
this way:
function loadClass($class)
{
if (strpos($class, '\\') !== FALSE && strncmp($class, '\\', 1)) {
$class = '\\' . $class;
}
return new $class;
}
OMG
David Grudl
--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php