The generic stdclass class in PHP (standard object)
I’m new to Object Oriented Programming in PHP and keep forgetting what the name of the generic PHP object is called.
Hence, I have created this post so I can keep a note of it.
Its called: stdclass
This acts as a built-in base class used to quickly create objects on the fly without having to write the code that formally defines it :
$cat = new stdClass;
$cat->furColour = ‘black’;
—
Problems
Jaxxed commented on its use on the mamboserver forum, see link below, and basically said that its a bit of a smelly type of variable to use and advises fellow coders make their own base class for use in scripts. Thus, one can add a bit more functionality and introspection capabilities.
Related Pages
A forum thread discussing stdclass: http://forum.mamboserver.com/showthread.php?t=936