bccamp
Technical User
- Jan 20, 2005
- 69
I'm trying to build an evolving list of words to be excluded from a master list. I can use:
but when I try to have the words added to a file, words.txt, I can't get the same results. I add the words with:
I've tried adding them with ' " ' and without. The text file that I wrote appears right with
or
I read the file with
but the code above will not remove the words like the first code will. What am I missing?
Code:
$elimt=array("a", "and", "the");
if (!in_array($key,$elimt)){
allow words;
}
but when I try to have the words added to a file, words.txt, I can't get the same results. I add the words with:
Code:
$newwordadded="$newword, $elimt";
$fp="file.txt";
fwrite($fp,$newwordadded);
I've tried adding them with ' " ' and without. The text file that I wrote appears right with
Code:
"a", "and", "the"
Code:
a, and, the
I read the file with
Code:
$fp=open("file.txt");
$elimt=fgets($fp);
while (!feof($fp)){
$elimt=$elimt.fgets($fp);
}
$elimt=(explode(",", $elimt));
but the code above will not remove the words like the first code will. What am I missing?