|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2013-08-03 17:03 UTC] juergen78 at gmail dot com
-: j dot haus at gmx dot at
+: juergen78 at gmail dot com
[2013-08-03 17:03 UTC] juergen78 at gmail dot com
[2015-06-15 23:28 UTC] cmb@php.net
-Status: Open
+Status: Duplicate
-Package: filter
+Package: Filter related
-Assigned To:
+Assigned To: cmb
[2015-06-15 23:28 UTC] cmb@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Nov 04 19:00:02 2025 UTC |
Description: ------------ There are filter_var() and idn_to_ascii(). - filter_var('bob@example.com', FILTER_VALIDATE_EMAIL); - idn_to_ascii() But the filter_var('bob@example.com', FILTER_VALIDATE_EMAIL) is not able to check international Domains. So it would be eligible if filter_var() itself can intern e.g. via idn_to_ascii() convert a international Domain bevor check. This time it is only doable with a workaround - see Below "Test Script" Test script: --------------- function validate_email($mail) { if ( ! filter_var($mail, FILTER_VALIDATE_EMAIL) ) { $in = explode('@', $mail); $in[1] = idn_to_ascii($in[1]); return (bool) filter_var(join('@', $in), FILTER_VALIDATE_EMAIL); } return true; } $mail = "foo@müller.de"; var_dump( validate_email($mail) );