namespace test{
use test\xyz\tikku;
use test\xyz\tikku as class_alias;
use function test\xyz\tikku\foo;
use function test\xyz\tikku\foo as func_alias;
use const test\xyz\tikku\ABC;
use const test\xyz\tikku\ABC as const_alias;
$obj=new tikku;
$obj->Display(); // I am in test\xyz namespace
$obj=new tikku\dhairya;
$obj->Display(); // I am in test\xyz\tikku namespace
$obj=new class_alias\dhairya;
$obj->Display(); // I am in test\xyz\tikku namespace
$obj=new \class_alias\dhairya;
$obj->Display(); // I am in class_alias namespace
}
namespace test\xyz{
class tikku{
function Display(){
echo "I am in ".__namespace__." namespace<br/><hr/>";
}
}
}
namespace test\xyz\tikku{
class dhairya{
function Display(){
echo "I am in ".__namespace__." namespace<br/><hr/>";
}
}
}
namespace class_alias{
class dhairya{
function Display(){
echo "I am in ".__namespace__." namespace<br/><hr/>";
}
}
}