Here is a class that can do what you want..
<?
class delWord {
var $theWord;
var $filename;
var $fileout;
function openfile ($filename, $theWord,$fileout) {
$this->theWord = $theWord;
$this->filename = $filename;
$this->fileout =$fileout;
$readdata = fopen($this->filename, "r");
$writendata=fopen($this->fileout, "w");
while($line = fgets($readdata, 1024)) {
if(strpos($line , "$this->theWord") === false) {
fputs($writendata, $line);
}
}
}
}
$obj = new delWord;
$obj ->openfile('C:\Program Files\Apache Group\Apache\htdocs\php_test\hello.txt','Hello','HelloNew.txt');