Alexis Alexis - 9 months ago 63
PHP Question

Is there a way to modify FILTER_SANITIZE_STRING

FILTER_SANITIZE_STRING basically does not also allow '.' DOTs. Is there any way to make it allow DOTs too?


Try this, hope this helps you -

 $smaller = "dots..";

You can use FILTER_FLAG_STRIP_LOW too.

From php source:

  • FILTER_SANITIZE_STRING - Strip tags, optionally strip or encode special characters.
  • FILTER_FLAG_STRIP_HIGH - Strip characters with ASCII value above 127.
  • FILTER_FLAG_STRIP_LOW - Strip characters with ASCII value below 32.

Actually from documentation FILTER_SANITIZE_STRING we don't get much information about this. So, we will get information from php source mentioned below:

Php sanitizing filters source

In above file look for php_filter_string