<?php
$filename = 'test.txt';
$somecontent = "Add this to the file\n Add this to the file\n";
/*
if (file_exists($filename)) { //
unlink($filename);
}*/
if (!$handle = fopen($filename, 'a+')) {
echo "Cannot open file ($filename)";
exit;
}
//for($i=0; $i<=10 ;$i++ ){
// $somecontent ="ºÃ÷Ѵ·Õè".$i."\\n" ;
if (fwrite($handle, $somecontent) === FALSE) {
echo "Cannot write to file ($filename)";
exit;
}
//}
echo "Success, wrote ($somecontent) to file ($filename)";
fclose($handle);
echo "The file $filename is not writable";
?>