Writing and Appending to a File : File Write : File Directory PHP Source Code


PHP Source Code » File Directory » File Write »

 

Writing and Appending to a File



<html>
<head>
<title>Writing and appending to a file</title>
</head>
<body>
<?php
$filename = "test1.txt";
print "Writing to $filename<br>";
$fp = fopen$filename, "w" or die("Couldn't open $filename");
fwrite$fp, "Hello worldn" );
fclose$fp );

print "Appending to $filename<br>";
$fp = fopen$filename, "a" or die("Couldn't open $filename");
fputs$fp, "And another thingn" );
fclose$fp );
?>
</body>
 </html>


           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo File Directory
» File Write