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

Popular posts from this blog

commonjs - How to write a typescript definition file for a node module that exports a function? -

openid - Okta: Failed to get authorization code through API call -

ios - Change Storyboard View using Seague -