Skip to content

Instantly share code, notes, and snippets.

@vickyRuiz
Created May 14, 2014 15:16
Show Gist options
  • Select an option

  • Save vickyRuiz/6b67bd6299cf8c1d5f95 to your computer and use it in GitHub Desktop.

Select an option

Save vickyRuiz/6b67bd6299cf8c1d5f95 to your computer and use it in GitHub Desktop.

Revisions

  1. vickyRuiz renamed this gist May 14, 2014. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  2. vickyRuiz created this gist May 14, 2014.
    19 changes: 19 additions & 0 deletions gistfile1.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    $normalizeChars = array(
    'Á'=>'A', 'À'=>'A', 'Â'=>'A', 'Ã'=>'A', 'Å'=>'A', 'Ä'=>'A', 'Æ'=>'AE', 'Ç'=>'C',
    'É'=>'E', 'È'=>'E', 'Ê'=>'E', 'Ë'=>'E', 'Í'=>'I', 'Ì'=>'I', 'Î'=>'I', 'Ï'=>'I', 'Ð'=>'Eth',
    'Ñ'=>'N', 'Ó'=>'O', 'Ò'=>'O', 'Ô'=>'O', 'Õ'=>'O', 'Ö'=>'O', 'Ø'=>'O',
    'Ú'=>'U', 'Ù'=>'U', 'Û'=>'U', 'Ü'=>'U', 'Ý'=>'Y',

    'á'=>'a', 'à'=>'a', 'â'=>'a', 'ã'=>'a', 'å'=>'a', 'ä'=>'a', 'æ'=>'ae', 'ç'=>'c',
    'é'=>'e', 'è'=>'e', 'ê'=>'e', 'ë'=>'e', 'í'=>'i', 'ì'=>'i', 'î'=>'i', 'ï'=>'i', 'ð'=>'eth',
    'ñ'=>'n', 'ó'=>'o', 'ò'=>'o', 'ô'=>'o', 'õ'=>'o', 'ö'=>'o', 'ø'=>'o',
    'ú'=>'u', 'ù'=>'u', 'û'=>'u', 'ü'=>'u', 'ý'=>'y',

    'ß'=>'sz', 'þ'=>'thorn', 'ÿ'=>'y' , " "=>"-", "¿"=>"", "¡"=>"", "!"=>"", "?"=>"", ","=>"", ";"=>"", "."=>"", ":"=>"",
    );

    function chareplace ($str, $mode = 0) { /* MODE 0: lowercase - You can add more modes if you like */
    global $normalizeChars;
    if ($mode == 0) {$string = strtr(strtolower($str), $normalizeChars);}
    return $string;
    }