cj333 cj333 - 1 year ago 106
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