I know I can do this:
//read the entire string
$str=implode("\n",file('somefile.txt'));
$fp=fopen('somefile.txt','w');
//replace something in the file string - this is a VERY simple example
$str=str_replace('Yankees','Cardinals',$str);
//now, TOTALLY rewrite the file
fwrite($fp,$str,strlen($str));
but, is there a more elegant and smarter way to rewrite a file that involves moving the cursor and replacing just a section of text? Seems that rewriting the file to replace one word is not smart
TIA,
samuel