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)));
$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