I am having a custom sort-funktion wich I use with usort:
function cmp($wert_a, $wert_b) {
$a = $wert_a["name"];
$b = $wert_b["name"];
if ($a == $b) {
return 0;
}
return ($a < $b) ? -1 : +1;
}
Now when I am having a array like this:5a,10b,6c,HR9,44x
it sorts it into 10b,44x,5a,6c,HR9.
I would like to have it sorted like 5a,6c,10b,44x,HR9
How can this be achieved?
Edit: One thing i didn't really mention (I did in code but not in text) is that it is a multi-dimensional array like this:
$array[0]["name"] = "5b";
$array[0]["..."] = "other values";
$array[1]["name"] = "10a";
$array[1]["..."] = "other values";
Using natsort and friends i cannot sort it like this.