PHP stdClass Object means the “Standard Predefined Classes ”. Generally it is generic empty class. And it is very effective way to use generic data object in your code. And it is Predefined class so no need to initialization.
Using stdClass you can create an object and assign data into it without having to formally define a class. let see how
Creating an Object
<?php //Creating an object ($ClassName) $ClassName = new stdClass(); //Assigning data into Object ($ClassName) $ClassName->Name = "Your Name"; $ClassName->Address = "Your Address"; $ClassName->Cell = "Your Cell No"; ?>
Print The Object
<?php print_r($ClassName); ?>
Output
SO you guys see how to assign data into stdClass and out or that data. It is possible to convert this object into array. You can do that by using type casting.