Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I'd be tempted to loop through the array and convert to English characters before sorting. E.g.</p> <pre><code>&lt;?php $array = array('Borgloon','Thuin','Lennik','Éghezée','Aubel'); setlocale(LC_CTYPE, 'nl_BE.utf8'); $newarray = array(); foreach($array as $k =&gt; $v) { $newarray[$k] = iconv('UTF-8', 'ASCII//TRANSLIT//IGNORE', $v); } sort($newarray); print_r($newarray); ?&gt; </code></pre> <p>Probably not the best in terms of processing speed/resources used. But sure does make it easier to understand the code.</p> <p><strong>Edit:</strong></p> <p>Thinking about it now, you might be better using some kind of lookup table, something like this:</p> <pre><code>&lt;?php $accentedCharacters = array ( 'à', 'á', 'â', 'ã', 'ä', 'å', 'ç', 'è', 'é', 'ê', 'ë', 'ì', 'í', 'î', 'ï', 'ñ', 'ò', 'ó', 'ô', 'õ', 'ö', 'ø', 'ù', 'ú', 'û', 'ü', 'ý', 'ÿ', 'Š', 'Ž', 'š', 'ž', 'Ÿ', 'À', 'Á', 'Â', 'Ã', 'Ä', 'Å', 'Ç', 'È', 'É', 'Ê', 'Ë', 'Ì', 'Í', 'Î', 'Ï', 'Ñ', 'Ò', 'Ó', 'Ô', 'Õ', 'Ö', 'Ø', 'Ù', 'Ú', 'Û', 'Ü', 'Ý' ); $replacementCharacters = array ( 'a', 'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e', 'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o', 'o', 'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u', 'y', 'y', 'S', 'Z', 's', 'z', 'Y', 'A', 'A', 'A', 'A', 'A', 'A', 'C', 'E', 'E', 'E', 'E', 'I', 'I', 'I', 'I', 'N', 'O', 'O', 'O', 'O', 'O', 'O', 'U', 'U', 'U', 'U', 'Y' ); $array = array('Borgloon','Thuin','Lennik','Éghezée','Aubel'); $newarray = array(); foreach($array as $k =&gt; $v) { $newarray[$k] = str_replace($accentedCharacters,$replacementCharacters,$v); } sort($newarray); print_r($newarray); ?&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload