As with the old MySQL connection, even if you do not close the connection you opened, PHP automatically disconnects at the end of the process. But if you say I will close it, it is enough to define “null”.

<?php
// we opened the connection
$db = new PDO('mysql:host=localhost;dbname=test', $user, $pass);[
 
// we closed the connection
$db = null;
?>