hi all,
this is my first post at php.net first of all thank you for this huge site :)
ok i found it usefull to post this for others. in the german language we have words like ' ' its called "umlaute" and it was a problem to me to "naturally" sort an huge array correctly so i coded this small block to get me helped, if anyone has an better idea please post and let us know as i am not a real crack :)
1. change each "umlaut" () into its "nearest" equivalent
2. natcasesorting it naturally
3. re-assiging the correct sorted array with the original-words again while keeping track of the KEY...
example-array:
$aSupplier = array(3 => "MAN",2 => "Atlas",16 => "Chevrolet",17 => "Chrysler",19 => "Citroen",24 => "DAF",25 => "Daihatsu",27 => "Daewoo",28 => "Demag",30 => "Dodge",36 => "Schierling",208 => "HIAB",38 => "Hffermann",39 => "Gergen",40 => "Kubato",41 => "Faun",43 => "Kleindienst",44 => "Swing",45 => "Neuhaus",46 => "Unimog",47 => "Meiller",48 => "Pfau-Johnston",49 => "Geesink",50 => "Schrling",51 => "Demag-Witting",53 => "Helmers",54 => "Ellermann",55 => "Jacobsen",56 => "Biki",57 => "Hansa",58 => "Kramer",59 => "Schmitz",60 => "Toro",61 => "Iseki",62 => "Haller",63 => "Kuka",64 => "Brock",65 => "Ambross",66 => "Sobernheimer",67 => "Pietsch",68 => "Kpper",69 => "Weisser",71 => "Wackenhut");
foreach ( $aSupplier as $key => $value )
{
$aSupplier2[$key] = strtr($aSupplier[$key], "", "AOUaous");
}
natcasesort($aSupplier2);
foreach ( $aSupplier2 as $key => $value )
{
if ( $aSupplier2[$key] != "" )
$aSupplier3[$key] = $aSupplier[$key];
}
echo "<pre>";
print_r($aSupplier3);
echo "</pre>";
greetz
tim