NYCPHP Meetup

NYPHP.org

[nycphp-talk] searching inside php source files

Gary Mort garyamort at gmail.com
Wed Dec 30 07:31:47 EST 2009


I would suggest in the future, doing a compare of the old and new file
contents and make a note when they are different.  That way if something
goes wrong, you know which files were changed.


On Wed, Dec 30, 2009 at 4:05 AM, Konstantin K <kkrutoi at gmail.com> wrote:

> Hey folks,
>
> I went with the following and it works nicely:
>
> $path_to_file = 'path/to/the/file';
> $file_contents = file_get_contents($path_to_file);
> $file_contents =
> str_replace("what_to_replace","replace_with",$file_contents);
> file_put_contents($path_to_file,$file_contents);
>
> courtesy of:
> http://stackoverflow.com/questions/1438563/find-and-replace-in-a-file
>
> Konstantin
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20091230/bca97245/attachment.html>


More information about the talk mailing list