// $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
);
});
语法中的错误是什么?
答案 0 :(得分:0)
您的支架有问题,这是您的代码的正确版本:
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;
});