xml() static public method

Converts an array to a XML string
static public xml ( array $array, string $tag = 'root', boolean $head = true, string $charset = 'utf-8', $tab = ' ', integer $level ) : string
$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 integer The indendation level
return string The XML string
Ejemplo n.º 1
0
    function testArrayXML()
    {
        $this->assertEqual(a::xml($this->arr), '<?xml version="1.0" encoding="utf-8"?>
<root>
  <cat>miao</cat>
  <dog>wuff</dog>
  <bird>tweet</bird>
</root>
');
    }