Location: PHPKode > scripts > XML Array > xml-array/XmlArrayTest.php
<?

include_once("class.XmlArray.php");

$path = "/home/user/test";

if ($mode == "createXML")
{
  $array[0] = "a. first element of array";
  $array[1] = "b. second element of array";
  $array[2] = "c. third element of array";
  $array[3] = "d. fourth element of array";

  $xml = new XmlArray();
  $xml->saveXML($array, "$path/XmlArrayTest.xml");
  echo "<a href=XmlArrayTest.xml target=_blank>open generated xml</a>";
}
else if ($mode == "readXML")
{
  $xml = new XmlArray();
  $array = $xml->getArray("$path/XmlArrayTest.xml");

  for ($i = 0; $i < count($array); $i++)
  {
    echo "array[$i] = $array[$i]<br>";
  }
}

?>
<br><br>
<a href="<?="$PHP_SELF?mode=createXML"?>">Create the XML Sample</a>
<br><br>
<a href="<?="$PHP_SELF?mode=readXML"?>">Read the XML Sample</a>
Return current item: XML Array