PHP File Handling

PHP File Handling is very impotent for serious programmers, we often use File Handing methods in web development, In this post i will cover file – Create, Open, Read, Write, Append, Close, and Delete Methods.

Create a File

Open a File

Read a File

Write to a File

Append to a File

Delete a File

Close a File

File Handling Modes list

Modes Description
r Read only. Starts at the beginning of the file
r+ Read/Write. Starts at the beginning of the file
w Write only. Opens and clears the contents of file; or creates a new file if it doesn’t exist
w+ Read/Write. Opens and clears the contents of file; or creates a new file if it doesn’t exist
a Append. Opens and writes to the end of the file or creates a new file if it doesn’t exist
a+ Read/Append. Preserves file content by writing to the end of the file
x Write only. Creates a new file. Returns FALSE and an error if file already exists
x+ Read/Write. Creates a new file. Returns FALSE and an error if file already exists

I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.

0 0 vote
Article Rating
Subscribe
Notify of
guest
1 Comment
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
DMCA.com Protection Status
1
0
Would love your thoughts, please comment.x
()
x