How can I locate a string in for example file.txt and then replace it with a new string then save the file?
So if I had
which was added by fwrite the line "someline, \r\n" and I wanted swap the bit orange_green_black, (written as "orange_green_black, \r\n") for apples_oranges_pears, how could I do it?red_green_blue,
orange_green_black,
violet_blue_pink,
I figured I could use str_replace somehow but I still don't know how I can get the file as a string (including the new line attributes \r\n) and replace a bit then save it leaving all else unchanged.
Any help much appreciated.