Tuesday, 12 July 2016

How to remove duplicate words from a string in PHP

The following example is to remove duplicate words from a given string .

$string = 'aaa bbb aaa ccc ddd ccc';

echo $string = implode(',',array_unique(explode(' ', $string)));



How to remove duplicate words from a string in PHP

No comments:

Post a Comment