File Handling

  1. Reading from and writing to files.
<?php
$myfile = fopen("example.txt", "w");
$txt = "John Doe\n";
fwrite($myfile, $txt);
fclose($myfile);

$myfile = fopen("example.txt", "r");
echo fread($myfile, filesize("example.txt"));
fclose($myfile);
?>

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *