Skip to content

Commit

Permalink
Replace sort() function calls with ksort() in basic ksort test
Browse files Browse the repository at this point in the history
Closes GH-6541.
  • Loading branch information
haszi authored and cmb69 committed Dec 27, 2020
1 parent 70dfbe0 commit 0db6f52
Showing 1 changed file with 27 additions and 27 deletions.
54 changes: 27 additions & 27 deletions ext/standard/tests/array/ksort_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ var_dump( $temp_array);

echo "\n-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --\n";
$temp_array = $unsorted_strings;
var_dump( sort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true)
var_dump( ksort($temp_array, SORT_STRING|SORT_FLAG_CASE) ); // expecting : bool(true)
var_dump( $temp_array);

echo "\n-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL --\n";
$temp_array = $unsorted_strings;
var_dump( sort($temp_array, SORT_NATURAL) ); // expecting : bool(true)
var_dump( ksort($temp_array, SORT_NATURAL) ); // expecting : bool(true)
var_dump( $temp_array);

echo "\n-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --\n";
$temp_array = $unsorted_strings;
var_dump( sort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true)
var_dump( ksort($temp_array, SORT_NATURAL|SORT_FLAG_CASE) ); // expecting : bool(true)
var_dump( $temp_array);

echo "\n-- Testing ksort() by supplying numeric array, 'flag' = SORT_NUMERIC --\n";
Expand Down Expand Up @@ -168,63 +168,63 @@ array(8) {
-- Testing ksort() by supplying string array (case insensitive), 'flag' = SORT_STRING|SORT_FLAG_CASE --
bool(true)
array(8) {
[0]=>
["b"]=>
string(6) "banana"
[1]=>
["l"]=>
string(5) "lemon"
[2]=>
["o"]=>
string(6) "orange"
[3]=>
["O"]=>
string(6) "Orange"
[4]=>
["O1"]=>
string(7) "Orange1"
[5]=>
["o2"]=>
string(7) "orange2"
[6]=>
["o20"]=>
string(8) "orange20"
[7]=>
["O3"]=>
string(7) "Orange3"
}

-- Testing ksort() by supplying string array (natural), 'flag' = SORT_NATURAL --
bool(true)
array(8) {
[0]=>
["O"]=>
string(6) "Orange"
[1]=>
["O1"]=>
string(7) "Orange1"
[2]=>
["O3"]=>
string(7) "Orange3"
[3]=>
["b"]=>
string(6) "banana"
[4]=>
["l"]=>
string(5) "lemon"
[5]=>
["o"]=>
string(6) "orange"
[6]=>
["o2"]=>
string(7) "orange2"
[7]=>
["o20"]=>
string(8) "orange20"
}

-- Testing ksort() by supplying string array (natural, case insensitive), 'flag' = SORT_NATURAL|SORT_FLAG_CASE --
bool(true)
array(8) {
[0]=>
["b"]=>
string(6) "banana"
[1]=>
["l"]=>
string(5) "lemon"
[2]=>
["o"]=>
string(6) "orange"
[3]=>
["O"]=>
string(6) "Orange"
[4]=>
["O1"]=>
string(7) "Orange1"
[5]=>
["o2"]=>
string(7) "orange2"
[6]=>
["O3"]=>
string(7) "Orange3"
[7]=>
["o20"]=>
string(8) "orange20"
}

Expand Down

0 comments on commit 0db6f52

Please sign in to comment.