remove words in php string

Question:

Hi E’s, I want remove words in the $string.
The variable $remove can contain one or more words, and I want remove that words from $string, like:
$remove = “remove words string”;
$string = “in php i want remove words in the string is a good idea remove for a great result”;

The return:
$string = “in php i want in the is a good idea for a great result”;

Regards, JC

Solution:

str_replace() can use an array as input, so the solution from rcflyr could be simplified into this:

1: $string = str_replace(explode(" ",$remove),"",$string);
Tags: · · ·
digg delicious stumbleupon technorati Google live facebook Sphinn Mixx newsvine reddit yahoomyweb
1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...