PHP FILTER_SANITIZE_STRIPPED Filter

Definition and Usage

FILTER_SANITIZE_STRIPPED filter removes or encodes unnecessary characters.

This filter is FILTER_SANITIZE_STRING Filter alias.

This filter removes data that could potentially harm the application. It is used to remove tags or delete or encode unnecessary characters.

  • Name: "string"
  • ID-number: 513

Possible options or flags:

  • FILTER_FLAG_NO_ENCODE_QUOTES - This flag does not encode quotes
  • FILTER_FLAG_STRIP_LOW - Remove characters with ASCII values below 32
  • FILTER_FLAG_STRIP_HIGH - Remove characters with ASCII values above 32
  • FILTER_FLAG_ENCODE_LOW - Encode characters with ASCII values below 32
  • FILTER_FLAG_ENCODE_HIGH - Encode characters with ASCII values above 32
  • FILTER_FLAG_ENCODE_AMP - Encode & character as &

Example

<?php

var_dump(filter_var($var, FILTER_SANITIZE_STRIPPED));
?>

Output:

string(13) "Bill Gates"