Monday 2 February 2015

FILTER_SANITIZE_EMAIL - PHP

FILTER_SANITIZE_EMAIL

The id of this filter is 517. We can sanitize any variable with email address to remove unwanted chars including blank space. This function FILTER_SANITIZE_EMAIL removes all except letters, digits and {|}!#/=$%*[]+-?^_`~&'@. 
Here is an example
$str='use= rid@example.com41!5~6+7'; // Change this value to get different result
$str = filter_var($str,FILTER_SANITIZE_EMAIL);
echo $str;
Output is here
use=rid@example.com41!5~6+7

0 comments:

Post a Comment