|
Posted by Stefan Mueller on 12/17/05 21:43
With the PHP command 'sort' I can sort an array. However, it doesn't exactly
sort the array I'd like to:
<html>
<body>
<?php
$my_array[0] = array("AA", "11");
$my_array[1] = array("AA", "22");
$my_array[2] = array("aa", "22");
$my_array[3] = array("AB", "11");
$my_array[4] = array("ab", "11");
$my_array[5] = array("ab", "22");
$my_array[6] = array("δb", "11");
$my_array[7] = array("ab", "33");
$my_array[8] = array("bb", "11");
$my_array[9] = array("eb", "11");
$my_array[10] = array("ιb", "11");
$my_array[11] = array("fa", "11");
sort($my_array);
for ($i = 0; $i <= 11; $i++) {
echo $my_array[$i][0] . " / " . $my_array[$i][1] . "<br>";
}
?>
</body>
</html>
=========================
Result:
AA / 11
AA / 22
AB / 11
aa / 22
ab / 11
ab / 22
ab / 33
bb / 11
eb / 11
fa / 11
δb / 11
ιb / 11
Requested result:
AA / 11
AA / 22
aa / 22
AB / 11
ab / 11
δb / 11
ab / 22
ab / 33
bb / 11
eb / 11
ιb / 11
fa / 11
Is it somehow possible to tell sort that it has to handle 'A' like 'a' and
also 'δ' like 'a'?
Stefan
[Back to original message]
|