<?php
$words  = array();
$string = ""Ich bin der Anfang, das Ende, die Eine, die Viele ist. Ich bin die Borg."";

$count_array  = array();

echo "Der String: ".$string." hat ".
     strlen($string)." Zeichen und ".
     str_word_count($string)." W&ouml;rter.<br />";

$words = explode(' ', $string);

foreach($words AS $word) {
  if(trim($word)) { // entfernt das Newline (\n) aus $string
    $count_array[$word]++;
  }
}

arsort($count_array);

foreach($count_array AS $word => $count) {
  echo "Das Wort "".$word."" kommt ".
        $count." mal vor.</br>"4
}
?>