Andu <[EMAIL PROTECTED]> wrote:
> 
> 
> --On Friday, July 18, 2003 14:28:02 -0700 Chris Shiflett <[EMAIL PROTECTED]> 
> wrote:
> 
> >--- Andu <[EMAIL PROTECTED]> wrote:
> >>This may show my ignorance or my refusal to take for granted
> >>something I don't fully understand but I have a hard time
> >>figuring out the advantage of using classes as opposed to just
> >>functions.
> >
> >They are entirely different. While OO fans will find my
> >over-simplification disgusting, a class is basically a way to associate
> >data with the functions that manipulate that data.
> 
> Say I have a database class with all kinds of functions for connection, 
> data manipulation, errors, etc:
> 
> $db = new db_sql;
> $db->connect();
> $db->do_this();
> $db->do_that();
> 
> How would that be different from an include file with a bunch of functions 
> doing the same thing?
> Is there any performance benefit one way or the other?

classes are slower than functions. Remember php was not and is not (will
not be?) designed for OO programming. its designed for web programming.

now tools like a class::$db may be slower (like anyone will notice a
difference cept in high crunch situations) it makes a lot easier for
fexibilty. ie.. changing database servers down the line..

 
Curt
-- 


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to