XML files are basically just a plain text file written in a specific structured style with .xml on the end rather than .txt
PHP Code:
$AllResults = array('result text one', 'result text two', 'result text three', 'result text four');
$myFile = "results.xml"; /// open file for writing
$fh = fopen($myFile, 'w') or die("can't open file");
foreach ($AllResults as $SingleResult){ /// loop through the array holding all results pulling out one at atime
$stringData .="<result>".$SingleResult."</result>\n"; /// Insert that result into a string and add all the strings together
}
fwrite($fh, $stringData);/// write the whole string to the file
fclose($fh);// close connection
Bookmarks