PHP FILTER_SANITIZE_STRING Filter
The FILTER_SANITIZE_STRING filter removes tags and remove or encode special characters from a string.
Possible options and flags : -
FILTER_FLAG_NO_ENCODE_QUOTES - Do not encode quotes
FILTER_FLAG_STRIP_LOW - Remove characters with ASCII value < 32
FILTER_FLAG_STRIP_HIGH - Remove characters with ASCII value > 127
FILTER_FLAG_ENCODE_LOW - Encode characters with ASCII value < 32
FILTER_FLAG_ENCODE_HIGH - Encode characters with ASCII value > 127
FILTER_FLAG_ENCODE_AMP - Encode the "&" character to &
Example -
Remove all HTML tags and all characters with ASCII value > 127, from a string : -
Example -