title: How to sort an associative array alphabetically in php?
body: <p>I am getting my array values from database. and it is just names of users.
  Iam printing them as it as they are retrieved , I want to print them Alphabetical order of their names (Ascending Order). How can I do this ?</p>
  
  <pre><code>foreach($common_follows as $row) // $common_follows contains the IDs of users
              {
  
          $names=$obj2-&gt;get_user_name($row); //this function gets the name from user ID
  
                      while   ($rows = mysql_fetch_assoc($names)) // For getting the name of the person being followed
                      {
                  sort($rows['name']); //Not seems to sort
                          echo '&lt;img src="https://graph.facebook.com/'.$rows['user_id'].'/picture?type=normal" width="65" height="20" id="fbthumb"&gt;';
                          echo $rows['name']."&lt;br&gt;";
                        $count_common++;
                      }
              }
  </code></pre>
  
  <p>That sort function does not seem to work , since at each loop iteration a single name is returned .</p>