Remove all non-ascii or non-printable characters from string
Hi, Yesterday i was struggling for removing non-ascii or you can say non-printable characters in string.
I have some google and found the way how to remove non-ascii characters.
$string = preg_replace('/[\x00-\x1F\x80-\xFF]/', '', $string);
It matches anything in range 0-31, 128-255 and removes it.
Hope this will help you.
Want to have your say? just login


Be first to show your opinion !!!