PHP - To remove repeated words in the given input

by barkkathulla 2014-10-11 15:04:20

PHP - How to Remove repeated words in the given string?
<?php
$input_text="its impressive thought.... nice thought";
$filtered_text=preg_replace('/(w{2,})(?=.*?\1)W*/', '',$input_text);
echo $filtered_text;
?>
Output:

its impressive nice thought
 
1692
like
0
dislike
0
mail
flag

You must LOGIN to add comments