Lets get on to the most
useful part of file
The function used
to write is called fwrite.
we can write to a file we have to open the file
variable contains the file handle for testFile.txt.
file handle knows the current file pointer, which for writing,
starts out at the beginning of the file.
to the file testFile.txt twice.
time we wrote
to the file we sent the string $stringData that
first contained Bobby Bopper and second contained Tracy
After we finished writing
we closed the file using
the fclose function.
were to open the testFile.txt file in NOTEPAD it
would look like this:
you open an existing file for writing with function fopen all the data
contained in the file is wiped clean and you start with an
In the example bel;ow we open
an existing file and write some new data into it.
If you now
open the testFile.txt file you will see that Bobby
and Tracy have both vanished, as we expected, and only the data we just
wrote is present.
NoteFor more detail please see Php Manual at http://www.php.net