For now I don't even see a reason, why: since you've got objects inside of objects, you'll need to cast the containing object to an array and iterate it. Free 30 Day Trial Wie das PHP-Handbuch sagt, . So I wrote an improved_var_export() function to convert instances of stdClass to (object) array () calls. (stdClass is already PHP's generic empty class) $a = stdClass:: __set_state(array()); Actually calling stdClass::__set_state () in PHP 5 will produce a fatal error. Alternatively you can check my edit for a non-dirty solution.Does not work with nested arrays. If an object is converted to object, it is not modified. If the array you pass to the implode function contains elements that are arrays, Array will be the output for each sub-array: They will still be arrays, not There are the Following The simple About stdclass object An Array Full Information With Example and source code.. As I will cover this Post with live Working example to develop how to remove std class object from array in php, so the how to get value from std class object in php is used for this example is following below. "PMP®","PMI®", "PMI-ACP®" and "PMBOK®" are registered marks of the Project Management Institute, Inc. MongoDB®, Mongo and the leaf logo are the registered trademarks of MongoDB, Inc. Array to stdClass can be done in php this way. Using PHP’s stdClass feature you can create an object, and assign data to it, without having to formally define a class. The stdClass is not the base class of the objects. and i dont know how to traverse it, and how could I get array like thisThe easiest way is to JSON-encode your object and then decode it back to an array:Or if you prefer, you can traverse the object manually, too:Very simple, first turn your object into a json object, this will return a string of your object into a JSON representative.Take that result and decode with an extra parameter of true, where it will convert to associative arrayARRAY_A is a “output_type” argument. Fatal error: Cannot use object of type stdClass as array inIs possible parse this stdClass to array and use this with keys?If not, what everybody else has said and just type cast itYour problem is probably solved since asking, but for reference, quick uncle-google answer:Cast it into an array. The decoding and encoding makes for a regular arraystdClass is an object so u can access value from it like Thanks for contributing an answer to Stack Overflow! This is easy if arrays and objects are one-dimensional, but might be little tricky if using multidimensional arrays and objects. The Overflow Blog So that means that you cannot define a class named stdClass in your PHP code. It is similar to Java or Python object. thanks @Ozzy for pointing out. print_r - Druckt menschenlesbare Informationen über eine Variable . One of the data structures that stores one or more similar types of values in a single name is an array but associative array in PHP is something different from a simple PHP array. your coworkers to find and share information. Keys are treated as property names, and values can be assigned to properties directly. By using our site, you acknowledge that you have read and understand our If the array you pass to the implode function contains elements that are arrays, Array will be the output for each sub-array: Childrens array still are stdObject@LucciFangorci You didn't mentioned, that you want the whole tree. Converting to object.