문제

Here is my code for to validate email address and this is perfect for my requirement. but i want to translate this format into Japanese language.Or Tell me such regular expression which used for multiple languages

if ( ! function_exists('valid_email')){
function valid_email($address)
{
    return ( ! preg_match("/^([a-z0-9\+_\-]+)(\.[a-z0-9\+_\-]+)*@([a-z0-9\-]+\.)+[a-z]{2,6}$/ix", $address)) ? FALSE : TRUE;
}}

Thanks in Advance.

도움이 되었습니까?

해결책

To validate an email in PHP, use PHP's built in filters. See here for full details:

Taken from the above URL, here's an example of how to validate an email:

if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
  echo "This ($email_a) email address is considered valid.";
}

Applied to your code, this would make your valid_email() function the following:

function valid_email($address) 
  return filter_var($address, FILTER_VALIDATE_EMAIL);
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top