Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File editing functions

Status
Not open for further replies.

kehers

Programmer
Aug 31, 2005
56
A2
I've been using some file functions lately for adding other contents to the original file content. however, i'd wanted to edit the content of a file lately but couldnt find the function to do dat. Is there any one of such?
i thought of using fget() to get the file content into an handle, match and preg_replace ther handle content (thus doing my editing), then overwrite the former file content with that of the handle, but still couldnt get any function to do the overwriting...
any help?
thanx.
 
Have alook at file_get_contents() - if your PHP version has that already. If not, it's time to upgrade.
The way you describe the editing process is the most common and sounds just right.
 
thanks guyz, but u didnt tell me how to overwrite the former file content
I think you missed the point on this one. We didn't give you the amswer on a plate because you were better off researching it yourself! I gave you a link to the online manual and DRJ478 made mention of a specific function.

Rather than post thinly-veiled complaints to the board, a simple "Thanks - found the answer in the manual" would be more appropriate, don't you think?

Anyway, I'm glad you found a solution [smile]
Cheer,
Jeff

[tt]Jeff's Page [/tt][tt]@[/tt][tt] Code Couch
[/tt]
 
Hey, i didnt mean to be rude...sorry if it looks that way
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top