<p>What is the best way to overwrite a specific line in a file? I basically want to search a file for the string '@parsethis' and overwrite the rest of that line with something else.</p>

If the file isn't too big, the best way would probably be to read the file into an array of lines with
file()
, search through the array of lines for your string and edit that line, then
implode()
the array back together and
fwrite()
it back to the file.