1
0
mirror of https://github.com/php/php-src.git synced 2026-04-18 05:21:02 +02:00
Files
archived-php-src/ext/standard/tests/array/rsort_variation7.phpt
Christoph M. Becker dabc28d182 Fix #78880: Spelling error report
We fix the most often occuring typos according to a recent codespell
report[1] in tests, code comments and documentation.

[1] <https://fossies.org/linux/test/php-src-master-f8f48ce.191129.tar.gz/codespell.html>.
2019-12-21 11:58:00 +01:00

96 lines
1.6 KiB
PHP

--TEST--
Test rsort() function : usage variations - boolean values
--FILE--
<?php
/* Prototype : bool rsort(array &$array_arg [, int $sort_flags])
* Description: Sort an array in reverse order
* Source code: ext/standard/array.c
*/
/*
* Pass rsort() arrays of boolean values to test behaviour
*/
echo "*** Testing rsort() : variation ***\n";
// bool value array
$bool_values = array (true, false, TRUE, FALSE);
echo "\n-- 'flag' value is default --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array) );
var_dump($temp_array);
echo "\n-- 'flag' value is SORT_REGULAR --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array, SORT_REGULAR) );
var_dump($temp_array);
echo "\n-- 'flag' value is SORT_NUMERIC --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array, SORT_NUMERIC) );
var_dump($temp_array);
echo "\n-- 'flag' value is SORT_STRING --\n";
$temp_array = $bool_values;
var_dump(rsort($temp_array, SORT_STRING) );
var_dump($temp_array);
echo "Done";
?>
--EXPECT--
*** Testing rsort() : variation ***
-- 'flag' value is default --
bool(true)
array(4) {
[0]=>
bool(true)
[1]=>
bool(true)
[2]=>
bool(false)
[3]=>
bool(false)
}
-- 'flag' value is SORT_REGULAR --
bool(true)
array(4) {
[0]=>
bool(true)
[1]=>
bool(true)
[2]=>
bool(false)
[3]=>
bool(false)
}
-- 'flag' value is SORT_NUMERIC --
bool(true)
array(4) {
[0]=>
bool(true)
[1]=>
bool(true)
[2]=>
bool(false)
[3]=>
bool(false)
}
-- 'flag' value is SORT_STRING --
bool(true)
array(4) {
[0]=>
bool(true)
[1]=>
bool(true)
[2]=>
bool(false)
[3]=>
bool(false)
}
Done