Tech Scraps
Friday, January 11, 2008
Removing all non-ASCII characters from a string using php
ASCII characters have hex code from 00 to 7F (http://www.asciitable.com/).
Following php function removes all non-ASCII characters from a string:
function removeNonAscii($string) {
return preg_replace('/[^\x00-\x7f]/','',$string);
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment