hello,
i have sentences as follow:
$quote[1] = "To be or not to be, that is the question.";
$quote[2] = "Love looks not with the eyes, but with the mind.";
$quote[3] = "Love all, trust a few. Do wrong to none.";
now I would like to do the following,
1) for each quote[$i], remove all ","(comma) or "."(full stop)...does anyone know how? I have the following code but it does not work. What should I write in $patterns?
for ($i=1; $i<4; $i++)
{
$quote[$i] = strtolower($quote[$i]);
echo "$quote[$i]<BR>";
$pieces = explode(" ", $quote[$i]);
for ($j=0; $j< (count($pieces)); $j++)
{
echo "$pieces[$j] ";
$patterns = ".\";
$replacement = "";
print preg_replace($patterns, $replacement, $string);
echo "$pieces[$j] <BR>";
}
}
2) also, I would like to count a) number of frequecy of each term (e.g. "to" has a frequency of 2 in qoute[1]) and b) number of frequency for all three quotes (i.e. "to" has frequency = 3)
but I have no idea how? can anyone please give me an idea?
Thank you very very much.