Page 1 of 1

editing a file with PHP

Posted: Mon May 12, 2008 6:03 pm
by frankm
Hello. I need PHP to edit a text file. For example.

I have a text file with the following contents:

Code: Select all

$color1 = red
$color2 = blue
$color3 = green
$color4 = orange
How would I have a PHP script go and edit color3 to yellow?

Thanks!

Re: editing a file with PHP

Posted: Mon May 12, 2008 6:54 pm
by califdon
frankm wrote:Hello. I need PHP to edit a text file. For example.

I have a text file with the following contents:

Code: Select all

$color1 = red
$color2 = blue
$color3 = green
$color4 = orange
How would I have a PHP script go and edit color3 to yellow?

Thanks!
Check out http://w3schools.com/php/php_ref_filesystem.asp