How can you check if a global class exists with class_exists if you are inside the namespace of another class? For example:
<?php
namespace Rvdv\Test\Example;
class ExampleClass
{
public function testNamespace()
{
// This says that it doesn't exists :(
print class_exists('\\Test');
}
}
Where class is a global defined class.
You've had to screw up something in your other issues - most likely the class test is not declared in this scope (did you forget include?). I tested this thusly:
phpcltest2.php:
<?php
class Test { }
phpcltest.php:
<?php
namespace Rvdv\Test\Example;
require 'phpcltest2.php';
class ExampleClass
{
public function testNamespace()
{
print class_exists('\\Test');
}
}
$nc = new ExampleClass();
$nc->testNamespace();
The results were expected: it prints out "1". So check your include paths.