stdClass

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.

<?php
$object=new stdClass();
$object->name=’PHPCodez’;
echo $object->name;
?>

Share

Leave a Reply

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