Revision: 16626
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 10, 2009 09:08 by fackz
Initial Code
<?php function just_clean($string) { // Replace other special chars $specialCharacters = array( '#' => '', '$' => '', '%' => '', '&' => '', '@' => '', '.' => '', '€' => '', '+' => '', '=' => '', '§' => '', '\\' => '', '/' => '', );</code> while (list($character, $replacement) = each($specialCharacters)) { $string = str_replace($character, '-' . $replacement . '-', $string); } $string = strtr($string, "ÀÃÂÃÄÅ� áâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÃÃŽÃìÃîïÙÚÛÜùúûüÿÑñ", "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn" ); // Remove all remaining other unknown characters $string = preg_replace('/[^a-zA-Z0-9\-]/', ' ', $string); $string = preg_replace('/^[\-]+/', '', $string); $string = preg_replace('/[\-]+$/', '', $string); $string = preg_replace('/[\-]{2,}/', ' ', $string); return $string; } ?>
Initial URL
http://www.bala-krishna.com/how-to-clean-special-characters-from-php-string
Initial Description
Initial Title
Clean Special Characters
Initial Tags
Initial Language
PHP