mardi 27 janvier 2015

Database properties as Interface Constants in PHP [on hold]


I bought a PHP Design Patterns book, and the author uses constants to hold connection attributes:



interface IConnectInfo {
const HOST = "localhost";
const UNAME = "root";
const PW = "jerrylewis99";
const DBNAME = "test";
public function doConnect();
}


I know this works, but is it considered good practice. What do programming experts have to say about "using constants to hold connection attributes?"





Aucun commentaire:

Enregistrer un commentaire