Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP FILTER_SANITIZE_SPECIAL_CHARS Filter

PHP FILTER_SANITIZE_SPECIAL_CHARS Filter


PHP Filter Reference Manual Complete PHP Filter Reference Manual


Definition and Usage

The FILTER_SANITIZE_SPECIAL_CHARS filter HTML-escapes special characters.

This filter is used to escape "<>& and characters with ASCII value below 32.

Possible flags:


Example

& funny?"; var_dump(filter_var($url,FILTER_SANITIZE_SPECIAL_CHARS)); ?>

The browser output of the code above is shown below:

string(37) "Is Peter & funny?"

If you view the source code in your browser, you will see the following HTML:

string(37) "Is Peter &

lt;

smart&

gt;

&

amp;

funny?"


PHP Filter Reference Manual Complete PHP Filter Reference Manual