Well first of all i guess i have to proove you wrong :/
$fp=fopen($filename,"r");
fseek($fp,100);
fwrite($fp,"DOGTHIS");
fclose($fp);
That will insert "dogthis" into lines.txt overwriting the text in the way.
Also right now i am using the array method but its way too slow, i'm dealing with a rather large file and writing it to an array to overwrite 1 line is insane.
Thanks,
Ben