Latest web development tutorials

PHP FILTER_SANITIZE_ENCODED filter

PHP Filter Reference Complete PHP Filter Reference

Definition and Usage

FILTER_SANITIZE_ENCODED filter to remove unwanted characters or URL-encoded.

The filter and the urlencode () function is very similar.

  • Name: "encoded"
  • ID-number: 514

Possible signs:

  • FILTER_FLAG_STRIP_LOW - removal of characters in the ASCII value of 32 or less
  • FILTER_FLAG_STRIP_HIGH - the removal of more than 32 characters in the ASCII value of
  • FILTER_FLAG_ENCODE_LOW - encoded characters in the ASCII value of 32 or less
  • FILTER_FLAG_ENCODE_HIGH - encoded ASCII value of the character above 32

Examples

<?php
$url="http://www.w3cschool.cc";

var_dump(filter_var($url,FILTER_SANITIZE_ENCODED));
?>

Output code is as follows:

string(30) "http%3A%2F%2Fwww.w3cschool.cc"


PHP Filter Reference Complete PHP Filter Reference