In PDO examples I often find the acronyms $dbh
and $sth
used. I suppose $dbh
stands for "database handle" - correct? What about $sth
? "Statement handle"?
Are there good reasons to use the above instead of $db_connection
and $query
(or other as appropriate)?
$dbh = "Database Handle"
$sth = "Statement Handle"
I prefer the longer forms, as they are more descriptive. It is often helpful to future maintainers if you are explicit, even when using common acronyms and abbreviations.
In the past, when hard drive capacity, memory and bandwidth were scarcer, the abbreviations may have made sense. Today there is (arguably) greater value in producing readable, maintainable code.