summaryrefslogtreecommitdiff
path: root/ext/standard/tests/strings/bug47481.phpt
blob: 4c59a7c377b186946f4ac0de6e8ec078b1081440 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--TEST--
Bug #47481 (natcasesort() does not sort extended ASCII characters correctly)
--FILE--
<?php
/* Prototype  : bool natcasesort(array &$array_arg)
 * Description: Sort an array using case-insensitive natural sort
 * Source code: ext/standard/array.c
 */

/*
 * Test natcasesort() with extended ASCII characters
 */

$array = array ('Süden', 'spielen','Sonne','Wind','Regen','Meer');
echo "\n-- Before sorting: --\n";
var_dump($array);

echo "\n-- After Sorting: --\n";
var_dump(natcasesort($array));
var_dump($array);

echo "Done";
?>
--EXPECTF--
-- Before sorting: --
array(6) {
  [0]=>
  %string|unicode%(6) "Süden"
  [1]=>
  %string|unicode%(7) "spielen"
  [2]=>
  %string|unicode%(5) "Sonne"
  [3]=>
  %string|unicode%(4) "Wind"
  [4]=>
  %string|unicode%(5) "Regen"
  [5]=>
  %string|unicode%(4) "Meer"
}

-- After Sorting: --
bool(true)
array(6) {
  [5]=>
  %string|unicode%(4) "Meer"
  [4]=>
  %string|unicode%(5) "Regen"
  [2]=>
  %string|unicode%(5) "Sonne"
  [1]=>
  %string|unicode%(7) "spielen"
  [0]=>
  %string|unicode%(6) "Süden"
  [3]=>
  %string|unicode%(4) "Wind"
}
Done