php convert array to object

An array can be converted to an object in PHP.





However you can not access the member of $a because there is not a name for the member of converted object. If you convert an array of  type key=>value (so called associative array) to an object, you will be able to access its members(properties) by their names which are the keys for the original array.






Note that the converted object is of class stdClass.

If you like my content, please consider buying me a coffee. Buy me a coffeeBuy me a coffee Thank you for your support!
Posted in

Leave a Reply