{ Snipperize }
Clean Special Characters
Clean Special Characters Add to Favorite
<?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;
}
?>
URL: http://www.bala-krishna.com/how-to-clean-special-characters-from-php-stringIf you are looking for the PHP special characters clean function then this post might be useful for you. This function can used to remove special character as well as able to replace specific character with other equivalent character or string.
Created by ThePeppersStudio (354 days, 3.81 hours ago)
Do you want to leave a message? Please login first.

