1--TEST--
2Test natcasesort() function : usage variations - different string types
3--SKIPIF--
4<?php
5if (substr(PHP_OS, 0, 3) == 'WIN') {
6  die("skip Output tested contains chars that are not shown the same on windows concole (ESC and co)");
7}
8--FILE--
9<?php
10/* Prototype  : bool natcasesort(array &$array_arg)
11 * Description: Sort an array using case-insensitive natural sort
12 * Source code: ext/standard/array.c
13 */
14
15/*
16 * Pass arrays of string data to see how natcasesort() re-orders the array
17 */
18
19echo "*** Testing natcasesort() : usage variation ***\n";
20
21$inputs = array (
22	// group of escape sequences
23	array(null, NULL, "\a", "\cx", "\e", "\f", "\n", "\t", "\xhh", "\ddd", "\v"),
24
25	// array contains combination of capital/small letters
26	array("lemoN", "Orange", "banana", "apple", "Test", "TTTT", "ttt", "ww", "x", "X", "oraNGe", "BANANA")
27);
28
29foreach ($inputs as $array_arg) {
30	var_dump( natcasesort($array_arg) );
31	var_dump($array_arg);
32}
33
34echo "Done";
35?>
36--EXPECTF--
37*** Testing natcasesort() : usage variation ***
38bool(true)
39array(11) {
40  [0]=>
41  NULL
42  [1]=>
43  NULL
44  [5]=>
45  string(1) ""
46  [6]=>
47  string(1) "
48"
49  [7]=>
50  string(1) "	"
51  [10]=>
52  string(1) ""
53  [4]=>
54  string(1) ""
55  [2]=>
56  string(2) "\a"
57  [3]=>
58  string(3) "\cx"
59  [9]=>
60  string(4) "\ddd"
61  [8]=>
62  string(4) "\xhh"
63}
64bool(true)
65array(12) {
66  [3]=>
67  string(5) "apple"
68  [2]=>
69  string(6) "banana"
70  [11]=>
71  string(6) "BANANA"
72  [0]=>
73  string(5) "lemoN"
74  [1]=>
75  string(6) "Orange"
76  [10]=>
77  string(6) "oraNGe"
78  [4]=>
79  string(4) "Test"
80  [6]=>
81  string(3) "ttt"
82  [5]=>
83  string(4) "TTTT"
84  [7]=>
85  string(2) "ww"
86  [8]=>
87  string(1) "x"
88  [9]=>
89  string(1) "X"
90}
91Done
92