Ich dachte, er will zuerst Großbuchstaben. Du meinst, er will:
<?php
$final_array[0]['score']='bar';
$final_array[1]['score']='Foo';
$final_array[2]['score']='Bar';
$final_array[3]['score']='foo';
usort( $final_array, function( $a, $b ) {
echo
'"' . $a['score'] . '" <=> "' . $b['score'] . '" : '
. ( $a['score'] <=> $b['score'] )
. ' => '
. ( -1 * ( $a['score'] <=> $b['score'] ) )
. PHP_EOL;
return -1 * ( $a['score'] <=> $b['score'] );
} );
print_r( $final_array );
mit diesem Ergebnis?
"bar" <=> "Foo" : 1 => -1
"Foo" <=> "Bar" : 1 => -1
"Bar" <=> "foo" : -1 => 1
"Foo" <=> "foo" : -1 => 1
"bar" <=> "foo" : -1 => 1
Array
(
[0] => Array
(
[score] => foo
)
[1] => Array
(
[score] => bar
)
[2] => Array
(
[score] => Foo
)
[3] => Array
(
[score] => Bar
)
)