I have this php code
$filename = "verbs.php"; // http://alylores.x10.mx/vega/verbs2.php
$handle = fopen($filename, "r");
$verbs = fread($handle, filesize($filename));
fclose($handle);
and i used PHP explode()
function
to split the words into array
$verbslist = explode(",", $verbs);
and i also have a string, like:
$sentence = "Where is Phisz' dog?";
and then i used the str_replace()
function to remove the verbs and some specifice words from the sentence, so that the only left will be the subject(s).
$newsentence = str_replace($verbslist,"",$sentence);
but the result is:
new Sentence: Phz' dog?
// the is
on Phisz
was also removed.
and i figured out that the problem is that the Phisz
words contain is
which was also removed with the str_replace()
.
what i want is how can i remove the words/vebs from the sentence without affecting other words. I mean removing the EXACT VERB/WORD..... and in case insensitive...
that the expected result will be like this
new Sentence: Phisz' dog?