title: Sorting an array / a variable by first letter in PHP
body: <p>How can you sort the following word by the given rule?</p>
  
  <p>Example data is <code>saapas</code> which I want to be either</p>
  
  <pre><code>aaapss
  </code></pre>
  
  <p>or in the array</p>
  
  <pre><code>s
  a
  a
  p
  a
  s
  </code></pre>
  
  <p>and then somehow</p>
  
  <pre><code>a
  a
  a
  p
  s
  s
  </code></pre>
  
  <p>The function <code>arsort</code> with <code>sort_flags</code> SORT_REQULAR and SORT_STRING did not work for me.</p>