<?php$arr=['a','b','a','c','d','d','d'];/*
Or this, if your input is a string
$arr = explode(' ', 'a b a c d d d');
*/$arr_count=[];foreach($arras$v){$arr_count[$v]=isset($arr_count[$v])?$arr_count[$v]+1:1;}arsort($arr_count);print_r($arr_count);
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Discussion on: How do I find most used 10 words in php
For further actions, you may consider blocking this person and/or reporting abuse