remove some words from string
Posted: Fri Dec 17, 2010 7:32 am
hi folks, i have a variable in which some common words are stored and another variable in which a sentence is stored. I want to remove the common words from the sentence> Is there any way of doing this in PHP?
the final output should be:
"I remove common words sentence."
Code: Select all
<?php
$common_words = "to, this, all, the, from";
$sentence = "I want to remove all the common words from this sentence";
?>"I remove common words sentence."