phpfilter-input

Stripping high/low ascii


What would something like this do?

function strip_high_low_ascii($string)
{
   return filter_var($string, FILTER_SANITIZE_STRING,
                              array('flags' => FILTER_FLAG_STRIP_HIGH|FILTER_FLAG_STRIP_LOW ));
}

It doesn't seem to work for me.


Solution

  • It strips any characters from the input string that are either lower than 32 ordinal, or higher than 127. Here is an ASCII reference table to show you which characters are between those values:

    http://www.asciitable.com/