lolitaloco

IdifyString() (rewrite Swedish letters in text string)

Oct 31st, 2011
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.63 KB | None | 0 0
  1. function IdifyString($string)
  2. {
  3.     $badChars = array(0 => "å",1 => "ä",2 => "ö",3 => "Å",4 => "Ä",5 => "Ö",6 => "&",7 => ",",8 => "(",9 => ")",10 => "!",11 => "'",12 => "\"",13 => "?",14 => "%",15 => "á",16 => "Á",17 => " ",18 => "/",19 => "\\",20 => ":",21 => "@",22 => "$",23 => "+");
  4.     $niceChars = array(0 => "a",1 => "a",2 => "o",3 => "a",4 => "a",5 => "o",6 => "",7 => "",8 => "",9 => "",10 => "",11 => "",12 => "",13 => "",14 => "",15 => "a",16 => "a",17 => "-",18 => "",19 => "",20 => "",21 => "",22 => "",23 => "");
  5.  
  6.     $idifiedString = strtolower(str_replace($badChars, $niceChars, $string));
  7.  
  8.     return $idifiedString;
  9. }
Add Comment
Please, Sign In to add comment