Method: a::xml
Converts an array to a XML string
Info
Syntax
a::xml($array, $tag='root', $head=true, $charset='utf-8', $tab=' ', $level)
Parameters
- $array (array) The source array
- $tag (string) The name of the root element
- $head (boolean) Include the xml declaration head or not
- $charset (string) The charset, which should be used for the header
- $level (int) The indendation level
Return (string)
The XML string
Example
$array = array(
'cat' => 'miao',
'dog' => 'wuff',
'bird' => 'tweet'
);
echo a::xml($array, 'animals');
// output:
// <animals>
// <cat>miao</cat>
// <dog>wuff</dog>
// <bird>tweet</bird>
// </animals>