Created
May 3, 2012 03:12
-
-
Save freshsnippets/2582757 to your computer and use it in GitHub Desktop.
PHP: Append to a File
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$my_file = 'file.txt'; | |
$handle = fopen($my_file, 'a') or die('Cannot open file: '.$my_file); | |
$data = 'New data line 1'; | |
fwrite($handle, $data); | |
$new_data = "\n".'New data line 2'; | |
fwrite($handle, $new_data); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment