I am learning PDO, and the constructor seems to use an unorthodox and inconsistent way of accepting arguments. Namely:
$dbh = new PDO("mysql:host=$host;dbname=$dbname", $user, $pass);
Why is it different from the usual format:
$dbh = new PDO("mysql", $host, $dbname, $user, $pass);
Or, since the first two arguments (host and dbname) are written as one long string, why not continue with the other two arguments? Namely:
$dbh = new PDO("mysql:host=$host;dbname=$dbname;user=$user;pass=$pass");
source share