I have a php array coming as result set from database.
as i am less familiar with mySQL sorting, i want to sort my result set based on the a particular string say "madhapur"
$arr=array(    
    array("name" => 'madhapur',"population" =>'1000'),
    array("name" => 'jubiliee hills',"population" =>'800'),
    array("name" => 'madhapur',"population" =>'900'),
    array("name" => 'adikmet',"population" =>'200'),
    array("name" => 'sr nagar',"population" =>'3000'),
    array("name" => 'jubilee hills',"population" =>'1200'),
    array("name" => 'madhapur',"population" =>'1000')   
    );
I am expecting the result as below
$arr=array(
array("name" => 'madhapur',"population" =>'1000'),
array("name" => 'madhapur',"population" =>'1000'),
array("name" => 'madhapur',"population" =>'900'),
array("name" => 'adikmet',"population" =>'200'),
array("name" => 'jubilee hills',"population" =>'1200'),
array("name" => 'jubiliee hills',"population" =>'800'),
array("name" => 'sr nagar',"population" =>'3000'),
);
I tried using usort but all of them are used to sort either descending or ascending.
function sortByName($a,$b){
         return $b['name'] - $a['name'];
    }
usort($arr,'sortByName');
 
     
     
    