Nov 11, 2011 #1 dldl Programmer May 3, 2010 40 NZ Hi; How could i get rid off the repeat words from an array? Thanks eg; $a[]="the , think , this , that , the , their , that , the , the , those"; i just want the array reduce to "the, think, that,those".
Hi; How could i get rid off the repeat words from an array? Thanks eg; $a[]="the , think , this , that , the , their , that , the , the , those"; i just want the array reduce to "the, think, that,those".
Nov 12, 2011 1 #2 jpadie Technical User Nov 24, 2003 10,094 FR Code: foreach ($a as &$wordlist): $temp = explode(',', $wordlist); $temp = array_map('trim', $temp); $temp = array_unique($temp, SORT_STRING); $wordlist = $temp; endforeach; Upvote 0 Downvote
Code: foreach ($a as &$wordlist): $temp = explode(',', $wordlist); $temp = array_map('trim', $temp); $temp = array_unique($temp, SORT_STRING); $wordlist = $temp; endforeach;