Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP FILTER_SANITIZE_STRING Filter

PHP FILTER_SANITIZE_STRING Filter


PHP Filter Reference Manual Complete PHP Filter Reference Manual


Definition and Usage

The FILTER_SANITIZE_STRING filter removes or encodes unwanted characters.

This filter removes data that is potentially harmful to your application. It is used to strip tags and remove or encode unwanted characters.

Possible options or flags:


Example

Peter Griffin"; var_dump(filter_var($var, FILTER_SANITIZE_STRING)); ?>

The output of the code is shown below:

string(13) "Peter Griffin"


PHP Filter Reference Manual Complete PHP Filter Reference Manual