Q:

When should I close database connection? 

I'm connecting to a MySQL database using
$dbh = new PDO("mysql:host=$db_host;dbname=$db_name", $db_user, $db_pass);

While reading through forums and tutorials it says that it is good practice (although not vital) to close a database connection as soon as you are finished with it.  So my question is this: should I always add $dbh = null; when the last database operation has been executed? 

A:

Connections are implicitly closed when a script has finished executing.  The only reason you may want to close a connection is if you plan on opening another one; even then, PDO supports multiple concurrent connections. 