<?php
namespace Foo\Bar;
class A
{
}
class B
{
public function __construct($type)
{
$fullType = 'Foo\\Bar\\' . $type;
echo "try to create $fullType\n";
new $fullType;
echo "$fullType created\n";
echo "try to create $type::class\n";
new $type::class;
echo "$type::class created\n";
echo "try to create $type\n";
new $type;
echo "$type created\n";
}
}
new A;
new B('A');