So geht’s:
function array2Object($array)
{
$object = new stdClass();
foreach ($array as $key => $value) {
if (is_array($value)) {
$object->$key = array2Object($value);
} else {
$object->$key = $value;
}
}
return $object;
}