FILTER_SANITIZE_ENCODED filter removes or URL-encodes unwanted characters.
This filter is very similar to the urlencode() function.
Name: "encoded"
ID-number: 514
Possible signs:
FILTER_FLAG_STRIP_LOW - strips characters with ASCII values below 32
FILTER_FLAG_STRIP_HIGH - remove characters with ASCII value above 32
FILTER_FLAG_ENCODE_LOW - Encode characters with ASCII values below 32
FILTER_FLAG_ENCODE_HIGH - Encode characters with ASCII values above 32
<?php$url="http://www.codercto.com";var_dump(filter_var($url,FILTER_SANITIZE_ENCODED));?>
The output of the code looks like this:
string(29) "http%3A%2F%2Fwww.codercto.com"