What is stdClass and how to work with it in PHP
stdClass is a default object which doesn't have predefined properties like a usual custom class. The name stdClass is used inside Zend and it's reserved. It means you can't define class using the name stdClass.
It can be used to create instances of objects then specific properties can set dynamically without predefining it. For example to pass an object to other function or method which expect to receive an object as an argument.
An example of use:
$person = new stdClass; $person->email = 'firstname.lastname@example.org'; $person->firstName = 'FirstName'; $person->secondName = 'SecondName'; var_dump( $person );
object(stdClass) public 'email' => string 'email@example.com' (length=19) public 'firstName' => string 'FirstName' (length=9) public 'secondName' => string 'SecondName' (length=10)