按字母顺序排序多维数组

take this multidimensional array for example:

$array = array( '0' => array("name"=>"xyc",...), '1' => array("name"=>"abc",...) );

Is there a way I can sort this array alphabetically with respect to the 'name' index in it's second dimension?

I have looked in the php manual and I have tried the asort function but it didn't work.

please don't get confused with the continuation dots I have given in the array.

you can use usort for this :

/*just example here*/  
<?php
$arr = array(
    0 => array('name' => 'xyc'),
    1 => array('name' => 'abc'),
    2 => array('name' => 'mno')
);

function test($a, $b) {
  return strcmp($a["name"], $b["name"]);
}
usort($arr, 'test');

print_r($arr);

See the demo : https://eval.in/999990

see more : ;http://php.net/manual/en/function.usort.php