original_string: public static function array_to_xml($array, &$xml)
  	{
  		foreach($array as $key => $value) {
  			if(is_array($value)) {
  				if(!is_numeric($key)){
  					$subnode = $xml->addChild("$key");
  					self::array_to_xml($value, $subnode);
  				} elseif ($key == 0) {
  					self::array_to_xml($value, $xml);
  				} else {
  					$name = $xml->getName();
  					$subnode = $xml->xpath("..")[0]->addChild("$name");
  					self::array_to_xml($value, $subnode);
  				}
  			} else {
  				$xml->addChild("$key","$value");
  			}
  		}
  	}
code: public static function array_to_xml($array, &$xml)
  	{
  		foreach($array as $key => $value) {
  			if(is_array($value)) {
  				if(!is_numeric($key)){
  					$subnode = $xml->addChild("$key");
  					self::array_to_xml($value, $subnode);
  				} elseif ($key == 0) {
  					self::array_to_xml($value, $xml);
  				} else {
  					$name = $xml->getName();
  					$subnode = $xml->xpath("..")[0]->addChild("$name");
  					self::array_to_xml($value, $subnode);
  				}
  			} else {
  				$xml->addChild("$key","$value");
  			}
  		}
  	}
code_tokens: public static function array_to_xml ( $ array , & $ xml ) { foreach ( $ array as $ key => $ value ) { if ( is_array ( $ value ) ) { if ( ! is_numeric ( $ key ) ) { $ subnode = $ xml -> addChild ( "$key" ) ; self :: array_to_xml ( $ value , $ subnode ) ; } elseif ( $ key == 0 ) { self :: array_to_xml ( $ value , $ xml ) ; } else { $ name = $ xml -> getName ( ) ; $ subnode = $ xml -> xpath ( ".." ) [ 0 ] -> addChild ( "$name" ) ; self :: array_to_xml ( $ value , $ subnode ) ; } } else { $ xml -> addChild ( "$key" , "$value" ) ; } } }
docstring: Helper function to convert an array to XML
  
  @param  array $array
  @param  SimpleXMLElement $xml
  @return string
docstring_tokens: Helper function to convert an array to XML