<?php
$arr = [
" ", // Spaces
"?", // Special Character
2, // Integer
3.01, // Float
"php", // Lower-case String
"pHP", // Camel-case String
"Hello", // Title-Case String
"123", // String Number
true, // Boolean
];
sort($arr, SORT_STRING | SORT_FLAG_CASE);
var_dump($arr);
- Output for 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.30, 8.2.0 - 8.2.25, 8.3.0 - 8.3.13
- array(9) {
[0]=>
string(2) " "
[1]=>
bool(true)
[2]=>
string(3) "123"
[3]=>
int(2)
[4]=>
float(3.01)
[5]=>
string(1) "?"
[6]=>
string(5) "Hello"
[7]=>
string(3) "php"
[8]=>
string(3) "pHP"
}
preferences:
78.34 ms | 407 KiB | 5 Q