01-09-2009, 12:27 AM
|
#14 (permalink)
|
|
The Addict
Join Date: Nov 2007
Location: USA
Posts: 256
Thanks: 7
|
In the previous example it is more work but say you have to connect to 10 or even 50 different databases. You would modify the class just a little to be something where you just declare an instance with
$con1 = new phpConnect("dbname1");
that code would be much shorter and easier to manage then 50 sepereate procedural declarations.
One benefit of OOP is that it also allows you to more easily reuse code. So on your next project you just take the db class from your last project and you already have that chunk of code written.
|
|
|
|