-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
  );
});

What is the error in the syntax?

Oliver Charlesworth
  • 267,707
  • 33
  • 569
  • 680

1 Answers1

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;

 });
Charaf JRA
  • 8,249
  • 1
  • 34
  • 44