I was playing around with filter_var to validate emails:
$email = "test@test.com"; 
if( filter_var( $email, FILTER_VALIDATE_EMAIL ) ){
    echo "{Valid Email";
}else{
    echo "Invalid Email";
}
That returns Valid Email.
But when I tried special characters like . $ # * ? & ! ^ ~ / ' - _ @ % {} | = + at the local part, Like :
$email = "te?st@test.com";
$email = "te/st@test.com";
$email = "te'st@test.com";
$email = "te}st@test.com";
$email = "te|st@test.com";
$email = "te=st@test.com";
That would return Valid Email too.
It's not accepting characters like <> [] ,.
But if I use $:
$email = "te$st@test.com";
That would return Valid Email, But also NOTICE Undefined variable: st
So should I use it to validate email addresses, Before inserting them to the DB?
Or I should use a custom Regular Expression?
