PHP OOP - Am I the only one?
View Single Post
01-09-2009, 12:27 AM
Join Date: Nov 2007
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.
iSearchNotes.com - Share College Student Notes
View Public Profile
Send a private message to CoryMathews
Visit CoryMathews's homepage!
Find More Posts by CoryMathews