Namespace

Hi can anyone guide me on how to use dynamic classname for namespace?
Basically I have a very simple example:

namespace A\\B; // <--- note is suppose to be A\\B but sitepoint removed the slash
class insideB {

    function __construct( ) {
        echo 'test';
    }
}

use A\\B;  // <---- note is suppose to be A\\B but sitepoint removed the slash

$test = 'insideB';
new $test( );  // this result in Fatal error: Class 'insideB' not found

$test = 'A\\B\\insideB';
new $test( );  // this result in test printed.

As above, why need to re-call A\B in the test variable when use A\B is already at the top of the page?

Not sure but this could be a bug in PHP. You might want to post an issue on the php.net website

With dynamic class instance creations, you have to use the “fully qualified name” (full namespace “path”) no matter what. I hope that this helps!

http://www.php.net/manual/en/language.namespaces.dynamic.php