stdClass is Generic empty class in PHP OR stdClass is universal base class in PHP.

stdClass is used to create anonymous objects with properties.

When we need to create an object without having new class. then we used stdClass class which is inbuilt in PHP.
After create object, we can add properties.

$object=new stdClass();
echo $object->name;

Leave a Reply

Your email address will not be published. Required fields are marked *