Determine repeat characters in a php string

后端 未结 5 1198
星月不相逢
星月不相逢 2021-01-16 23:48

I have found many examples of how to find repeat characters in a string. I believe my requirement is unique.

I have string

$string=aabbbccffffd;
         


        
5条回答
  •  悲哀的现实
    2021-01-17 00:19

    $data = "aabbbcccffffdz";
    $array = str_split($data);
    $v = array_count_values($array);
    foreach($v as $k => $val){ 
            echo $k.' = '.$val.'
    '; }

提交回复
热议问题