PHP File Handling:-
PHP supports file handling with opening a file,closing a file,reading a file,writing a file etc. functions.This tutorial will let you know about every mode of file handling. The table will introduce you with the various mode of file opening.
PHP supports this feature using the following functions:-
i) fopen:-
To open a file in a particular mode, like r: read, w: write, a: append etc.
ii) feof:-
To check whether the pointer has reached at the end of the file or not.
iii) fclose:-
To close the file.
iv) fgets:-
To extract the content line by line.
v) fgetc:-
To extract the content character by character.
MODES DESCRIPTION:-
r read only
r+ read and write
w write only, clears the previous content, creates the file if it does not exist
w+ read/write, clears the previous content, creates the file it is not present
a append, open and write the content to the end of the file, creates if the file is not present
a+ append/write, open and write the content to the end of the file, creates if the file is not present
x write only, returns an error message and false value if the file is present otherwise creates the new file
x+ read/write , returns an error message and false value if the file is present otherwise creates the new file
RSS Feed
Twitter
March 1st, 2013
Prashant Patil