I want destroy the PDO connection, I can do this creating a private variable with this structure: $this->_pdo = new PDO(credentials here)
and then in the same class:
function __destruct()
{
$this->_pdo = NULL;
}
But for some operation like lastInsertedId
I need to call the parent construct. So I need to use this structure:
public function __construct($dbhost, $dbname, $dbuser = 'root', $dbpass = '', $dbtype = 'mysql') {
parent::__construct($dbtype . ':host=' . $dbhost . ';dbname=' . $dbname, $dbuser, $dbpass);
}
How can I destroy the connection using the parent construct?