On Wed, June 14, 2006 1:08 pm, Mariano Guadagnini wrote:
> I hace an existencial doubt: i've seem many scripts declaring classes
> as
> stdClass. In the documentation (for PHP5 and also for 4), it says that
> this class is internal of php, and should't be used. By the manner I
> saw
> it's being used, i guess that it can be handy to create a 'generic' or
> so class, and append members when needed on the fly, without the need
> for a formal class declaration, but i could't find any good source
> explaining that. Has somebody some info about?

When you do:

class foo { };

I believe that, down in the guts, foo is a "subclass" of stdClass.

Now, assuming you want to be all loosy-goosy and not really hard-core
other-language purist OOP...

$foo = new stdClass;

is not really significantly different from:

class foo { }; $foo = new foo;

So, put it this way:  If your OOP inhibitions are loose enough to want
to use stdClass in the first place, and then start throwing data into
it like:

$foo->undeclared_member_variable = 42;

Then, really, I don't think using stdClass is gonna be a Big Issue,
compared to what you are already doing.

This is merely my opinion, and is not meant to reflect the Documented
Featureset, and certainly not the current direction Internals seems to
be taking with OOPurism.

Since I never actually use class (much) in the first place, I don't
really care either way. :-)

-- 
Like Music?
http://l-i-e.com/artists.htm

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

Reply via email to