Snippet Name: Remove all non-ASCII chars
Description: Removes all non-ASCII chars (like "ã", "ô", "ç", etc). Great for sanitizing input strings.
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: March 01st, 2009
|
<?PHP
$string = "Remove these characters: ã ç ó ô";
$string = PREG_REPLACE('/[^(\x20-\x7F)]*/','', $string);
?> |