Question

im doing to using STOP WORD for erase some conjuntion words : like this, the, in .

im still using read string then replace from file then erase those conjuntion words and here is the code

$fh = fopen("search/E_a_02.txt", "r");

$file = file_get_contents("search/E_a_02.txt");
$stop="BI";
echo str_replace($stop, "", $file);

i want that variable $stop is like array , that include stop words, then erase the sentence from the file, what should i do?

pleaseee help.

thank you master :)

Was it helpful?

Solution

Try:

$stop = array("this","the","in");
echo str_replace($stop, "", $file);

It should replace all occurrence of $stop in $file

OTHER TIPS

try with this

$fh = fopen("search/E_a_02.txt", "r");

$file = file_get_contents("search/E_a_02.txt");

$stop=array("BI","BE");

echo str_replace($stop, "", $file);

hope this will solve your problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top