-3
//  $vote_table[index]['voter_meta']['name'] is the key to sort by.

usort( $vote_table, function( $a, $b ){
 return ($a['voter_meta']['name'] == $b['voter_meta']['name'])
  ? 0
  : ( ($a['voter_meta']['name'] < $b['voter_meta']['name'])
   ? -1
   : 1
  );
});

语法有什么错误?

4

1 回答 1

0

You had problem with a bracket , here is the correct version of your code :

 usort( $vote_table, function( $a, $b ){

     return ($a['voter_meta']['name'] == $b['voter_meta']['name'])
     ? 0  
     : ($a['voter_meta']['name'] < $b['voter_meta']['name'])
     ? -1
     : 1;

 });
于 2013-08-26T23:16:34.687 回答