How can I access standard internal classes from within a namespace?
namespace foo;
class Bar{
public function __construct(){
$connect = new \PDO('mysql:host='.$host.';dbname='.$name, $user, $pass);
}
}
I'm getting an error
failed to open stream PDO.php
I have autoloader code that is working for my custom classes. How can I have the autoloader ignore the internal classes?
I am referring to this link and my code is based on that:
http://www.php.net/manual/en/language.namespaces.faq.php#language.namespaces.faq.globalclass
Edit:
So if I put something like this, it seems to work fine. But then what's the point if I can't use it inside my own class? How would I make the parameters dynamic based on class properties?
namespace foo;
$connect = new \PDO('mysql:host='.$host.';dbname='.$name, $user, $pass);
class Bar{
public function __construct(){
//$connect = new \PDO('mysql:host='.$host.';dbname='.$name, $user, $pass);
}
}