FILTER_SANITIZE_SPECIAL_CHARS constant in PHP

PHPProgrammingServer Side Programming

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

 Live Demo

<?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?"
raja
Published on 04-Dec-2018 08:40:22
Advertisements