I'm trying to write a function that will return a reference to a PDO object. The reason for wanting a reference is if, for some reason, the PDO object gets called twice in one page load, it will just return the same object rather than initializing a new one. This isn't silly, is it? :/
function &getPDO()
{
var $pdo;
if (!$pdo)
{
$pdo = new PDO...
return $pdo;
}
else
{
return &pdo;
}
}
Something like that