/** * transcode arrays recursively * * @param array the variable to convert * @return converted object (which is also the input array) */ public static function to_xml_recursively(&$input) { global $context; // sanity check if (!is_array($input)) { return utf8::to_xml($input); } // process all attributes foreach ($input as $name => $value) { if (is_array($value)) { $input[$name] = utf8::to_xml_recursively($value); } else { $input[$name] = utf8::to_xml($value); } } return $input; }