<?php
$text = file_get_contents('PATH_TO.txt ');
$text = explode(' ',$text);
foreach ($text as $key => $word ) {
if (strlen($word) >4) {
$words[] = $word;
}
}
$count = array_count_values($words);
array_multisort($count,SORT_DESC);
$i = 1;
foreach ($count as $key => $value) {
echo 'Number of occurances:<b> '.$value.' </b>of word: <b>'.$key."</b><br>\n";
$i++;
}
?>