????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.55 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /proc/self/root/home/b8009/php-5.6.22/ext/standard/tests/array/ |
Upload File : |
--TEST--
Test natcasesort() function : usage variations - mixed array
--FILE--
<?php
/* Prototype : bool natcasesort(array &$array_arg)
* Description: Sort an array using case-insensitive natural sort
* Source code: ext/standard/array.c
*/
/*
* Pass an array containing sub-arrays, ints, floats, strings, boolean, null
* and escape characters to test how natcasesort() re-orders it
*/
echo "*** Testing natcasesort() : usage variation ***\n";
$mixed_values = array (
array(),
array( array(33, -5, 6),
array(11),
array(22, -55),
array()
),
-4, "4", 4.00, "b", "5", -2, -2.0, -2.98989, "-.9", "True", "",
NULL, "ab", "abcd", 0.0, -0, "abcd\x00abcd\x00abcd", '', true, false
);
// suppress errors as is generating a lot of "array to string" notices
var_dump( @natcasesort($mixed_values) );
var_dump($mixed_values);
echo "Done";
?>
--EXPECTF--
*** Testing natcasesort() : usage variation ***
bool(true)
array(22) {
[13]=>
NULL
[19]=>
string(0) ""
[21]=>
bool(false)
[12]=>
string(0) ""
[10]=>
string(3) "-.9"
[7]=>
int(-2)
[8]=>
float(-2)
[9]=>
float(-2.98989)
[2]=>
int(-4)
[16]=>
float(0)
[17]=>
int(0)
[20]=>
bool(true)
[3]=>
string(1) "4"
[4]=>
float(4)
[6]=>
string(1) "5"
[14]=>
string(2) "ab"
[15]=>
string(4) "abcd"
[18]=>
string(14) "%s"
[0]=>
array(0) {
}
[1]=>
array(4) {
[0]=>
array(3) {
[0]=>
int(33)
[1]=>
int(-5)
[2]=>
int(6)
}
[1]=>
array(1) {
[0]=>
int(11)
}
[2]=>
array(2) {
[0]=>
int(22)
[1]=>
int(-55)
}
[3]=>
array(0) {
}
}
[5]=>
string(1) "b"
[11]=>
string(4) "True"
}
Done