Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Assuming you've already gotten a list of folders on the server (via <code>while()</code> loop or <code>glob()</code> function) and this list is stored in <code>$folderList[]</code>, I'd try something like the following if you're just outputting the result:</p> <pre><code>$a = array(...); $e = array(...); $i = array(...); $o = array('Ò','Ó','Ô','Õ','Ö','ò','ó','ô','õ','ö'); $u = array(...); foreach($folderList as $folder){ $folder = str_replace($a,"a",$folder); $folder = str_replace($e,"e",$folder); $folder = str_replace($i,"i",$folder); $folder = str_replace($o,"o",$folder); $folder = str_replace($u,"u",$folder); } </code></pre> <p>It's fairly sloppy, but it's also fairly simple. If you wanted something that would run quicker you'd be looking at doing math or comparisons with the binary value of the unicode. For instance, everything in the <code>$o</code> array is the unicode characters 00D2 to 00D6 and 00F2 to 00F6. So if the letter is between <code>dechex('00D2')</code> and <code>dechex('00D6')</code> OR that letter is between <code>dechex('00F2')</code> and <code>dechex('00F6')</code> then replace it with "o".</p> <p>If you're getting the value without the special characters (such as via URL post) and you want to map it to a folder, then you have to take a slightly different approach. First, realize that this isn't the ideal solution since you may have two folders, one named <code>Òdla</code>, one named <code>Ödla</code>. In this case, the search phrase <code>odla</code> could only refer to <strong>one</strong> of these folders. The other would be permanently ignored. Assuming you're fine with this (such as: you can guarantee that there will be no such duplicate folder names), you would probably want to use <code>GLOB_BRACE</code>.</p> <pre><code>&lt;?php $vowels = array("a", "e", "i", "o", "u"); $replace = array("...", "...", "...", "{Ò,Ó,Ô,Õ,Ö,ò,ó,ô,õ,ö}", "..."); $search = "odla"; $search = str_replace($vowels, $replace, $search); // Returns every folder who matches "Òdla", "Ódla", "Ôdla".... glob($search, GLOB_BRACE); ?&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. 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