title: php: sort and count instances of words in a given string
body: <p>I need help sorting and counting instances of the words in a string.</p>
  <p>Lets say I have a collection on words:</p>
  <blockquote>
  <p>happy beautiful happy lines pear gin happy lines rock happy lines pear</p>
  </blockquote>
  <p>How could I use php to count each instance of every word in the string and output it in a loop:</p>
  <pre><code>There are $count instances of $word
  </code></pre>
  <p>So that the above loop would output:</p>
  <blockquote>
  <p>There are 4 instances of happy.</p>
  <p>There are 3 instances of lines.</p>
  <p>There are 2 instances of gin....</p>
  </blockquote>