/** * Convert an ordered array to XML * Wraps each element in the singular form of the root element * * @param array ordered array * @param string root element, plural * @return string XML String */ public static function ordered2xml($ordered, $root_element = "elements") { if (!is_array($ordered) || count($ordered) == 0) { return "<" . $root_element . " />\n"; } foreach ($ordered as $element) { $xml .= xml::assoc2xml($element, inflector::singular($root_element)); } return "<" . $root_element . ">\n" . xml::pad($xml) . "</" . $root_element . ">\n"; }