<?php $f=file_get_contents('file1.txt'); $f=str_replace('#','&',$f); $newfile=fopen('file2.txt','w'); fputs($newfile,$f); fclose($newfile); ?>