Computer >> Computer tutorials >  >> Programming >> PHP

FILTER_SANITIZE_SPECIAL_CHARS constant in PHP


The FILTER_SANITIZE_SPECIAL_CHARS constant filter HTML-escapes special characters.

Flags

  • FILTER_FLAG_STRIP_LOW − Strip characters with ASCII value below 32

  • FILTER_FLAG_STRIP_HIGH − Strip characters with ASCII value above 32

  • FILTER_FLAG_ENCODE_HIGH − Encode characters with ASCII value above 32

Return

The FILTER_SANITIZE_SPECIAL_CHARS constant does not anything.

Example

<?php
   $var = "Favorite Sports is Football & Cricket?";
   var_dump(filter_var($var,FILTER_SANITIZE_SPECIAL_CHARS));
?>

Output

The following is the output.

string(43) "Favorite Sports is Football & Cricket?"