Is there any example of using SORT_LOCALE_STRING where it would give a different result to the default SORT_STRING when using array_unique?
Here is some code that shows how you can get different results between SORT_STRING, SORT_REGULAR, SORT_NUMERIC.
<?php
$list = array(
'0',
null,
0,
10,
'10.0',
'1e1',
false,
''
);
var_dump(array_unique($list));
var_dump(array_unique($list, SORT_NUMERIC));
var_dump(array_unique($list, SORT_REGULAR));
Output:
array(5) {
[0]=>
string(1) "0"
[1]=>
NULL
[3]=>
int(10)
[4]=>
string(4) "10.0"
[5]=>
string(3) "1e1"
}
array(2) {
[0]=>
string(1) "0"
[3]=>
int(10)
}
array(4) {
[0]=>
string(1) "0"
[1]=>
NULL
[3]=>
int(10)
[7]=>
string(0) ""
}
Please help me find an example that shows a use for SORT_LOCALE_STRING.
I guess in german,
ßandssare considered lexicographically equal I think. Basically, they should be considered the same character and sort as such. If you don’t use a locale sensitive string comparison(sorting is string comparison), then, I think it’s pretty obvious those two strings wont compare as being equal.yields, on my machine(win7, php5.4rc2)