$f = "mi_archivo.txt";$old = file_get_contents($d);$nuevo = "Esto es lo nuevo".$old;$fh = fopen($f, 'w');fwrite($fh, $nuevo);fclose($fh);