strcoll()'s behavior is sometimes a little bit confusing. It depends on LC_COLLATE in your locale.
<?php
$a = 'a';
$b = 'A';
print strcmp ($a, $b) . "\n"; setlocale (LC_COLLATE, 'C');
print "C: " . strcoll ($a, $b) . "\n"; setlocale (LC_COLLATE, 'de_DE');
print "de_DE: " . strcoll ($a, $b) . "\n"; setlocale (LC_COLLATE, 'de_CH');
print "de_CH: " . strcoll ($a, $b) . "\n"; setlocale (LC_COLLATE, 'en_US');
print "en_US: " . strcoll ($a, $b) . "\n"; ?>
This is useful e. g. if want to sort an array by using strcoll:
<?php
$a = array ('a', 'A', '�', '�', 'b', 'B');
setlocale (LC_COLLATE, 'C');
usort ($a, 'strcoll');
print_r ($a);
?>
This is like sort($a):
Array
(
[0] => A
[1] => B
[2] => a
[3] => b
[4] => �
[5] => �
)
<?php
setlocale (LC_COLLATE, 'de_DE');
usort ($a, 'strcoll');
print_r ($a)
?>
This is completely different:
Array
(
[0] => a
[1] => A
[2] => �
[3] => �
[4] => b
[5] => B
)