How to remove duplicate words from string using php? -
below variable have,
$string = 'aaa,bbb,aaa,bbb,aaa,bbb';
i need unique string result below,
$string = 'aaa,bbb,aaa,bbb';
how make unique array_unique()
function , there default string function remove duplicate string in php?
i don't php have such function, can process this: live demo
$raw = 'aaa,bbb,aaa,bbb,aaa,bbb'; $string = implode(',', array_unique(explode(',', $raw)));
Comments
Post a Comment