title: Computing the percentage of values in an array
body: <p>I have the following array:</p>
  
  <pre><code>[ratings] =&gt; Array
   (
        [0] =&gt; 3
        [1] =&gt; 3
        [2] =&gt; 2
        [3] =&gt; 3
        [4] =&gt; 3
        [5] =&gt; 1
        [6] =&gt; 3
        [7] =&gt; 4
        [8] =&gt; 5
   )
  </code></pre>
  
  <p>What would be the best and fastest way to get the the percentage of each rating. For example there are 9 ratings now, and 5 ratings of "3", so the percentage of rating "3" is 55.55%.</p>