cj333 cj333 -3 years ago 161
PHP Question

how to remove some words in php

I want to remove all the prepositions(in, at, on...), definite articles(a, an ,the...) and be verbs(is, are, was...) from a article. Is there a short way that php can do that?

$article= "the cup is on the table";// I want get an echo like "cup table"

Answer Source

You can use str_ireplace(), create an array with the words you want gone and use str_ireplace($prepArr,'',$str);

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download