I've been doing some reading up on OOP in PHP, and looking at some of the
classes available on the web, and I've got what is probably a stupid
question.  I've seen this many many times..

class someclass {
        var $somevar = "someval";

        function set( $key, $val ) {
                $this->$key = $val;
        }
}

$myClass = new someclass;
$myClass->set( "somevar", "someotherval" );

why write a set method when you can just as easily call
$myClass->somevar = "someotherval";

Is there a reason for this?

Also, alot of the different table classes (an OOP approach to HTML tables)
stores the data in arrays, but at what point is it too much to store into an
array?  Say you have a forum and the text entered for a single respone could
be quite lengthy, much less for 100 replies...  wouldn't that be a bit much
to store into an array?  I know it depends on the system resources, but is
there a practical limit that people follow?



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to