<?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);
var_dump($arr);
- Output for 7.1.25 - 7.1.28, 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.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.14, 8.4.1 - 8.4.2
- 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:
76.56 ms | 408 KiB | 5 Q