[php] overwriteing with fwrite()

Hoi


$handle = fopen($filename, 'a');
fwrite($handle, $somecontent));
fclose($handle);

this will add $somecontent to a text(i think)
but how do i overwrite whats all ready in the text with $somecontent ??

:} thanx :}


$file = "myText.txt";

$fp = fopen($file, "a");

ftruncate($fp, 0);

$fwrite($fp, $somecontent);

$fclose($fp);

ftruncate is what you want. Check the manual for details.

thanks :}