How to use FILTER SANITIZE SPECIAL CHARS in PHP

This article describe about FILTER_SANITIZE_SPECIAL_CHARS filter in PHP.
  • 4787

FILTER_SANITIZE_SPECIAL_CHARS filter

For filter HTML-escapes special characters FILTER_SANITIZE_SPECIAL_CHARS used.

For escape "<> & and characters with ASCII value below 32 ", this filter is used.

  • Name: "special_chars"
  • ID-number: 515

Possible 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

Example

<html>
<body>
<?php
$url="Is shoan <smart> & funny?";
var_dump(filter_var($url,FILTER_SANITIZE_SPECIAL_CHARS));
?>
</body>
</html>

Output

pic5.jpg

You may also want to read these related articles Click here

Ask Your Question 

Got a programming related question? You may want to post your question here

Programming Answers here

Categories

More Articles

© 2020 DotNetHeaven. All rights reserved.