There is a line with the text, quite large.
Question: how to sort out at the output and output that such a word occurs so many times, and such a word - so many times. And so that it is sorted descending. For example in this format: the word - the number of times.

I looked in the direction of multisort, but it seems to me that this is not the case.

  • @oldzas, If you are given an exhaustive answer, mark it as correct (click on the check mark next to the selected answer). - Vitalina

1 answer 1

  1. strtolower(); - bring the string to lower case
  2. preg_replace(); - remove all punctuation marks
  3. explode(); - divide the string by a space in the array
  4. array_count_values(); we get the number of repetitions in the array
  5. Profit!

It seems not a complicated algorithm, implement it yourself =)