what i want to do is find a word from a text file and delete that word using php plzzzzzzzzz help me.........

i can find the word using this codes

$handle = file_get_contents("files.txtl",NULL);
$a="first";
$a=substr_replace($a, '0', 0);
$a=explode(" ",$a);
$c=0;
foreach($a as $y){
if (stristr($handle,"$a[$c]")) $b[]= 'yes';
else $b[]='no';
$c++;
}
if (in_array("no",$b)) echo '<br><br>did not match';
else echo '<br><br>we have a match';

Recommended Answers

All 6 Replies

hellooooooo any 1 to help me...............

$strText = file_get_contents( 'file.txt' );

$strFind = 'word';

$blMatch = false;

if( preg_match( "/$strFind/", $strText ) ) {

[INDENT]$blMatch = true;

$strText = str_replace( $strWord, '', $strText );[/INDENT]

}

That will tell you if your word is found, and it will remove it from the string.

R.

$strWord
this is a undefined index

Oops, meant to be $strFind.

R

hello;
what i want to do is find a word from a text file and delete that word using java netbeans plz help me.........

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.