core error

stdclass in PHP

Posted on: 26/07/2011


stdClass is php’s generic empty class.


Using PHP’s stdClass feature you can create an object, and assign data to it, without having to formally define a class.


You can quickly create an object out of the stdClass to hold data in it:

$movie          = new stdClass;
$book->name     = "Back to the Future";
$book->director = "Robert Zemeckis";
$book->cast     = array('Michael J. Fox', 'Christopher Lloyd', 'Lea Thompson');

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s


  • None
  • Justin Cooney: Great comic, this made me laugh!
  • Justin Cooney: Interesting, I didn't know about the Google App Engine, I'm glad I found your article on it!


%d bloggers like this: