How can I print usernames in order using entity_load function? I'm using drupal 7.28, and I have fetched user id using entity_load('user'), so I need descending sorting on usernames using this way of logic, let me know if anyone has an idea.Here is my code that I have written in my file.

$users = entity_load('user',$sort);
$usersIds = array_keys($users);
foreach($usersIds as $usrId)
{    
   $user = user_load($usrId);
   $user_load_name = array($user-&gt;name);
   echo "&lt;pre&gt;";
   print_r($user_load_name);
}
small change in your code will do it for you 

$users = entity_load('user');//load all user in your site
$usersIds = array_keys($users); // get all uid of the user
foreach($usersIds as $usrId) {
    $user = user_load($usrId); 
    $user_load_name = $user-&gt;name;//get the user name
    $user_load_name1[] = $user_load_name;// store all user name in array 
 }
 natcasesort($user_load_name1);//For sorting array in ascending order INCASE SENCITIVE order
 $arr = array_reverse($user_load_name1, true);// For making it in descending  


This code will only give the user name in Decending order if you want it in ascending order just remove array_reverse() line that will be enough. 

hope it helps you :)