EDIT:
I fixed my typos, and calling a class IS NOT case sensitive
i’m seeing that if I have
class A
{
public function __construct()
{
echo 'hello';
}
}
and do this
if (class_exists('a'))
$class = 'a';
$a = new $class();
I will see
hellohello
If i comment out the if statement then I’m okay, it will echo out
hello
How can I stop the class_exists() from running the classes constructor?
EDIT:
this is my usage
foreach ($this->getNamespace() as $ns) {
//if (class_exists($ns . '\\' . $controller))
$controller = $ns . '\\' . $controller;
if (class_exists($ns . '\\' . $model))
$model = $ns . '\\' . $model;
}
$model = new $model($this->config);
$controller = new $controller($this->config);
When running the following code:
I get:
Your problem is likely elsewhere.