Categories
PHP

Converting Array to Object in PHP

Here’s a funny little code snippet that demonstrates the flexibility of PHP. Here, we first define an array. Then cast it into an object. And guess what, the keys of the arrays become public variables of the newly created object.

I was impressed to find it out…. Just have a look :

Cool, eh ? 😉