static function ToXML($var, $root="")
	{
		$xml = "";
		
		if (is_object($var))
		{
			// object have properties that we recurse
			$name = strlen($root) > 0 && is_numeric($root) == false ? $root : get_class($var);
			$xml .= "<".$name.">\n";
			
			$props = get_object_vars($var);
			foreach (array_keys($props) as $key)
			{
				$xml .= VerySimpleXmlUtil::ToXML( $props[$key], $key );
			}
			
			$xml .= "</".$name.">\n";
		}
		elseif (is_array($var))
		{
			$name = strlen($root) > 0 ? (is_numeric($root) ? "Array_".$root : $root) : "Array";
			$xml .= "<".$name.">\n";
			
			foreach (array_keys($var) as $key)
			{
				$xml .= VerySimpleXmlUtil::ToXML( $var[$key], $key );
			}
			
			$xml .= "</".$name.">\n";
		}
		else
		{
			$name = strlen($root) > 0 ? (is_numeric($root) ? "Value_".$root : $root) : "Value";
			$xml .= "<".$name.">" . VerySimpleXmlUtil::Escape($var) . "</".$name.">\n";
		}

		return $xml;
	}
static function ToXML($var, $root="")
	{
		$xml = "";
		
		if (is_object($var))
		{
			// object have properties that we recurse
			$name = strlen($root) > 0 && is_numeric($root) == false ? $root : get_class($var);
			$xml .= "<".$name.">\n";
			
			$props = get_object_vars($var);
			foreach (array_keys($props) as $key)
			{
				$xml .= VerySimpleXmlUtil::ToXML( $props[$key], $key );
			}
			
			$xml .= "</".$name.">\n";
		}
		elseif (is_array($var))
		{
			$name = strlen($root) > 0 ? (is_numeric($root) ? "Array_".$root : $root) : "Array";
			$xml .= "<".$name.">\n";
			
			foreach (array_keys($var) as $key)
			{
				$xml .= VerySimpleXmlUtil::ToXML( $var[$key], $key );
			}
			
			$xml .= "</".$name.">\n";
		}
		else
		{
			$name = strlen($root) > 0 ? (is_numeric($root) ? "Value_".$root : $root) : "Value";
			$xml .= "<".$name.">" . VerySimpleXmlUtil::Escape($var) . "</".$name.">\n";
		}

		return $xml;
	}
static function ToXML ( $ var , $ root = "" ) { $ xml = "" ; if ( is_object ( $ var ) ) { // object have properties that we recurse
 $ name = strlen ( $ root ) > 0 && is_numeric ( $ root ) == false ? $ root : get_class ( $ var ) ; $ xml .= "<" . $ name . ">\n" ; $ props = get_object_vars ( $ var ) ; foreach ( array_keys ( $ props ) as $ key ) { $ xml .= VerySimpleXmlUtil :: ToXML ( $ props [ $ key ] , $ key ) ; } $ xml .= "</" . $ name . ">\n" ; } elseif ( is_array ( $ var ) ) { $ name = strlen ( $ root ) > 0 ? ( is_numeric ( $ root ) ? "Array_" . $ root : $ root ) : "Array" ; $ xml .= "<" . $ name . ">\n" ; foreach ( array_keys ( $ var ) as $ key ) { $ xml .= VerySimpleXmlUtil :: ToXML ( $ var [ $ key ] , $ key ) ; } $ xml .= "</" . $ name . ">\n" ; } else { $ name = strlen ( $ root ) > 0 ? ( is_numeric ( $ root ) ? "Value_" . $ root : $ root ) : "Value" ; $ xml .= "<" . $ name . ">" . VerySimpleXmlUtil :: Escape ( $ var ) . "</" . $ name . ">\n" ; } return $ xml ; }
Recurses value and serializes it as an XML string
@param variant $var object, array or value to convert
@param string $root name of the root node (optional)
@return string XML
Recurses value and serializes it as an XML string