Code:
$lookfor = '|<024version>(.*)</024version>|Ui';
preg_match_all($lookfor,$html,$results,PREG_PATTERN_ORDER);
$writecontent = '';
for ($c = 0; $c < sizeof($results[1]); $c++) {
$writecontent .= $results[1][$c]."\n";
}
$fp = fopen($outputfile,'a');
fwrite($fp,$writecontent);
fclose($fp);
this should do it...