Return to Snippet

Revision: 10812
at January 14, 2009 10:08 by prf_q


Initial Code
<?php

// FUNCION BY Ahmet Alp Balkan
// http://www.ahmetalpbalkan.com

function replaceAccents($newphrase){

	$newphrase = str_replace("Ü","U",$newphrase);
	$newphrase = str_replace("Ã…Â?","S",$newphrase);
	$newphrase = str_replace("�","G",$newphrase);
	$newphrase = str_replace("Ç","C",$newphrase);
	$newphrase = str_replace("Ä°","I",$newphrase);
	$newphrase = str_replace("Ö","O",$newphrase);
	$newphrase = str_replace("ü","u",$newphrase);
	$newphrase = str_replace("ÅŸ","s",$newphrase);
	$newphrase = str_replace("ç","c",$newphrase);
	$newphrase = str_replace("ı","i",$newphrase);
	$newphrase = str_replace("ö","o",$newphrase);
	$newphrase = str_replace("ÄŸ","g",$newphrase);

	$newphrase = str_replace("Ü","U",$newphrase);
	$newphrase = str_replace("Ã…?","S",$newphrase);
	$newphrase = str_replace("Ä?","G",$newphrase);
	$newphrase = str_replace("Ç","C",$newphrase);
	$newphrase = str_replace("Ä°","I",$newphrase);
	$newphrase = str_replace("Ö","O",$newphrase);
	$newphrase = str_replace("ü","u",$newphrase);
	$newphrase = str_replace("ÅŸ","s",$newphrase);
	$newphrase = str_replace("ç","c",$newphrase);
	$newphrase = str_replace("ı","i",$newphrase);
	$newphrase = str_replace("ö","o",$newphrase);
	$newphrase = str_replace("ÄŸ","g",$newphrase);


	$newphrase = str_replace("Ü","U",$newphrase);
	$newphrase = str_replace("Äž","G",$newphrase);
	$newphrase = str_replace("Åž","S",$newphrase);
	$newphrase = str_replace("Ä°","I",$newphrase);
	$newphrase = str_replace("Ö","O",$newphrase);
	$newphrase = str_replace("Ç","C",$newphrase);
	$newphrase = str_replace("ü","u",$newphrase);
	$newphrase = str_replace("ÄŸ","g",$newphrase);
	$newphrase = str_replace("ÅŸ","s",$newphrase);
	$newphrase = str_replace("ı","i",$newphrase);
	$newphrase = str_replace("ö","o",$newphrase);
	$newphrase = str_replace("ç","c",$newphrase);
	
	
	$newphrase = str_replace("Ù","U",$newphrase);
	$newphrase = str_replace("Äž","G",$newphrase);
	$newphrase = str_replace("Åž","S",$newphrase);
	$newphrase = str_replace("Ä°","I",$newphrase);
	$newphrase = str_replace("Ö","O",$newphrase);
	$newphrase = str_replace("Ç","C",$newphrase);
	$newphrase = str_replace("ü","u",$newphrase);
	$newphrase = str_replace("ÄŸ","g",$newphrase);
	$newphrase = str_replace("ÅŸ","s",$newphrase);
	$newphrase = str_replace("ı","i",$newphrase);
	$newphrase = str_replace("ö","o",$newphrase);
	$newphrase = str_replace("ç","c",$newphrase);

	$newphrase = str_replace("%u015F","s",$newphrase);
	$newphrase = str_replace("%E7","c",$newphrase);
	$newphrase = str_replace("%FC","u",$newphrase);
	$newphrase = str_replace("%u0131","i",$newphrase);
	$newphrase = str_replace("%F6","o",$newphrase);
	$newphrase = str_replace("%u015E","S",$newphrase);
	$newphrase = str_replace("%C7","C",$newphrase);
	$newphrase = str_replace("%DC","U",$newphrase);
	$newphrase = str_replace("%D6","O",$newphrase);
	$newphrase = str_replace("%u0130","I",$newphrase);
	$newphrase = str_replace("%u011F","g",$newphrase);
	$newphrase = str_replace("%u011E","G",$newphrase);
	
	$newphrase = str_replace("£","E",$newphrase);
	$newphrase = str_replace("é","e",$newphrase);
	$newphrase = str_replace("è","e",$newphrase);
	$newphrase = str_replace("ß","x",$newphrase);
	
	$a = 'ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõöøùúûýýþÿŔŕ';
    $b = 'aaaaaaaceeeeiiiidnoooooouuuuybsaaaaaaaceeeeiiiidnoooooouuuyybyRr';
    $newphrase = utf8_decode($newphrase);    
    $newphrase = strtr($newphrase, utf8_decode($a), $b);
     

	
	
	$newphrase = strtr($newphrase, "à âäçéèêëîïôöûü","aaaceeeeiioouu");

return $newphrase;
}
?>

Initial URL

                                

Initial Description
// FUNCION BY Ahmet Alp Balkan
// http://www.ahmetalpbalkan.com

Initial Title
Replace All Latin Accents

Initial Tags
php, replace, filter

Initial Language
PHP