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

 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?"

Updated on: 27-Jun-2020

464 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements