PHP5 - function array2object()


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. // PHP5 only...
  2.  
  3. function array2object(array $array) {
  4. $object = new stdClass();
  5. foreach($array as $key => $value) {
  6. if(is_array($value)) {
  7. $object->$key = array2object($value);
  8. } else {
  9. $object->$key = $value;
  10. }
  11. }
  12. return $object;
  13. }

URL: http://www.ab-d.fr/date/2008-07-19/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.