Alexis Alexis - 3 years ago 117
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?

Answer Source

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

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download