Appending to a file : fwrite « File Directory « PHP

Appending to a file


  # 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 );


  <title>Appending to a file</title>


  $file_length = filesize( $filename );
  echo( "$filename is now $file_length bytes" );



Related examples in the same category

1.A simple access counter
2.fwrite() function writes string to the file.
4.Using file-related error information
5.Writing data to a file
6.Storing user information in a text file