How to remove all duplicate characters from a string in PHP

1 Answer

0 votes
$s = "phpppp prooooooograaaaaammingggggg laaanguage";
 
// count_chars(string $string, int $mode = 0): array|string
// mode 3 = a string containing all unique characters is returned.

$s = count_chars($s, 3);
 
echo $s;
     
        
 
/*
run:
             
 aeghilmnopru
      
*/

 



answered Oct 28, 2019 by avibootz
edited Mar 5 by avibootz
...