$cat = get_categories(); // hent de
usort($cat, "cmp"); // sorter de
print_r($cat) ; // vis de
function cmp($cats,$b){
$tegn = 'abcdefghijklmnopqrstuvwxyzæøå';
$c1 = strtolower($cats->name);
$c2 = strtolower($b->name);
if($c1{0}==$c2{0}){
$t = 1;
while(isset($c1{$t}) && isset($c2{$t})){
if($c1{$t}==$c2{$t}){
$t++;
}else{
return (strpos($tegn,$c1{$t})<strpos($tegn,$c2{$t})) ? -1 : 1;
}
}
return (isset($b{$t})) ? -1 : 1;
}
else{
return (strpos($tegn,$c1{0})<strpos($tegn,$c2{0})) ? -1 : 1;
}
}