Hindi Songs

Search About PHP!!!

Wednesday, July 1, 2009

Closing a File

The fclose() function is used to close an open file:
< ?php
$file = fopen("test.txt","r");

//some code to be executed

fclose($file);
? >

________________________________________
Check End-of-file
The feof() function checks if the "end-of-file" (EOF) has been reached.

The feof() function is useful for looping through data of unknown length.
Note: You cannot read from files opened in w, a, and x mode!
if (feof($file)) echo "End of file";