I am ordering an array to display a multiselect, but when I change the system language I have some labels that have accentuation in their first letter, by undoing my array and entering the words that have accentuation to the end of the list. >
I got the example below that solved me, IN PARTS! How do I work with Postgree, SQLServer and Oracle my charset changes according to the database / client. So making my array clutter again.
I can not get it to be "UTF-8" and "ASCII" functional at the same time.
Can anyone help me resolve to sort this array independent of charset encoding? My result is as below, Index 3 is going to the end of the array.
Result:
[1] => AMDEC [11] => Audit [8] => Compétence [13] => Contrôle [6] => Incident [9] => Inspection [2] => MSP [4] => Performance [0] => Plan d´action [7] => Problème [10] => Questionnaire [12] => Risque [14] => Test [15] => Traitement [5] => Workflow [3] => Étalonnage'
uasort($termos, "arrayOrdenation");
function arrayOrdenation($name1, $name2){
$patterns = array(
'a' => '(á|à|â|ä|Á|À|Â|Ä)',
'e' => '(é|è|ê|ë|É|È|Ê|Ë)',
'i' => '(í|ì|î|ï|Í|Ì|Î|Ï)',
'o' => '(ó|ò|ô|ö|Ó|Ò|Ô|Ö)',
'u' => '(ú|ù|û|ü|Ú|Ù|Û|Ü)'
);
$name1 = preg_replace(array_values($patterns), array_keys($patterns), $name1);
$name2 = preg_replace(array_values($patterns), array_keys($patterns), $name2);
return strcasecmp($name1, $name2);
}