/ Published in: PHP
Converts multi-dimensional array to stdClass
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function arrayToObject($array) { return $array; } $object = new stdClass(); foreach ($array as $name=>$value) { $object->$name = arrayToObject($value); } } return $object; } else { return FALSE; } }
URL: http://www.richardcastera.com/blog/php-convert-array-to-object-with-stdclass