Appending to a file
<?php
# for Linux use...
# $filename = "/home/mike/Desktop/newfile.txt";
# for Windows use...
$filename = "C:\\newfile.txt";
$file = fopen( $filename, "a" );
$string = "\t\t\tOctober 13,2010";
fwrite( $file, $string );
fclose( $file );
?>
<html>
<head>
<title>Appending to a file</title>
</head>
<body>
<?php
$file_length = filesize( $filename );
echo( "$filename is now $file_length bytes" );
?>
</body>
</html>
Related examples in the same category