File Handling in PHP
Files are opened in PHP using the fopen command. The command takes two parameters, the file to be opened, and the mode in which to open the file. The function returns a file pointer if successful, otherwise zero (false). Files are opened with fopen for reading or writing.
$fp = fopen("myfile.txt", "r");
if ( !($fp = fopen("myfile.txt", "r") ) )
exit("Unable to open the input file.");