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?
Code: Select all
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>";
}
}but I have no idea how? can anyone please give me an idea?
Thank you very very much.