Im need some help removing some common words from a string in this function
$topic = 'My wonderfull day at the beach';
function get_related_topics($topic) {
$common_words = array('is','and','but','also','the','as','im','into','therefore',
'of','because','to','from','with','there','my','your','am','same','be','these',
'those','while','a','out','in','at','still','is','many','who','both','are','about',
'on');
$topic_words = explode(' ',$topic);
foreach($topic_words as $topic_word) {
if(!strpos($common_words,$topic_word)) {
$clean_words[] = $topic_word;
}
}
print_r($clean_words);
}
Im trying to remove the common words from $topic, and leave the rest ...
Ive tried mutiple ways, with str_replce, and strpos to test .. but this doesnt work
what am i doing wrong?
Print_r should only print "wonderfull day beach"