Writes to a file.
fwrite() writes data to a file. If a length is specified, that is the maximum number of bytes written. Otherwise, the whole string will be written. The number of bytes written is returned, or false if an error occurred.
<?php
$filename = "dummy.txt";
$logfile = fopen($filename, "w");
$nwritten = fwrite($logfile, "This is some data");
print "$nwritten bytes were written to the file";
?> 17 bytes were written to the file This code writes to a file and prints how many bytes were written.