3v4l.org

run code in 300+ PHP versions simultaneously
<?php $emails = array( 'test@example.com', 'test.derp@example.com', 'test+nick@example.com', 'abc."defghi".xyz@example.com', '"abcdefghixyz"@example.com', 'jsmith@[192.168.2.1]', 'jsmith@[IPv6:2001:db8::1]', 'long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com', 'other.email-with-dash@example.com', '"much.more unusual"@example.com', '"very.unusual.@.unusual.com"@example.com', '"very.(),:;<>[]\".VERY.\"very@\\ \"very\".unusual"@strange.example.com', 'admin@mailserver1 (local domain name with no TLD)', '#!$%&\'*+-/=?^_`{}|~@example.org', '"()<>[]:,;@\\\"!#$%&\'*+-/=?^_`{}| ~.a"@example.org', '" "@example.org (space between the quotes)', '☃☃☃@example.com (Unicode characters in local part)', '☃☃☃@☃☃☃.com (Unicode characters in domain part)', 'new@domain.pizza' ); foreach ($emails as $email) { echo (filter_var($email, FILTER_VALIDATE_EMAIL)) ? "[+] Email $email is valid\n" : "[-] Email $email is NOT valid\n"; }
Output for 5.2.14 - 5.2.17, 5.3.3 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.25, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.26, 8.1.0 - 8.1.13
[+] Email test@example.com is valid [+] Email test.derp@example.com is valid [+] Email test+nick@example.com is valid [+] Email abc."defghi".xyz@example.com is valid [+] Email "abcdefghixyz"@example.com is valid [+] Email jsmith@[192.168.2.1] is valid [+] Email jsmith@[IPv6:2001:db8::1] is valid [+] Email long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com is valid [+] Email other.email-with-dash@example.com is valid [-] Email "much.more unusual"@example.com is NOT valid [+] Email "very.unusual.@.unusual.com"@example.com is valid [+] Email "very.(),:;<>[]\".VERY.\"very@\ \"very\".unusual"@strange.example.com is valid [-] Email admin@mailserver1 (local domain name with no TLD) is NOT valid [+] Email #!$%&'*+-/=?^_`{}|~@example.org is valid [-] Email "()<>[]:,;@\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org is NOT valid [-] Email " "@example.org (space between the quotes) is NOT valid [-] Email ☃☃☃@example.com (Unicode characters in local part) is NOT valid [-] Email ☃☃☃@☃☃☃.com (Unicode characters in domain part) is NOT valid [+] Email new@domain.pizza is valid
Output for 5.2.1 - 5.2.13, 5.3.0 - 5.3.2
[+] Email test@example.com is valid [+] Email test.derp@example.com is valid [+] Email test+nick@example.com is valid [-] Email abc."defghi".xyz@example.com is NOT valid [+] Email "abcdefghixyz"@example.com is valid [+] Email jsmith@[192.168.2.1] is valid [-] Email jsmith@[IPv6:2001:db8::1] is NOT valid [+] Email long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com is valid [+] Email other.email-with-dash@example.com is valid [+] Email "much.more unusual"@example.com is valid [+] Email "very.unusual.@.unusual.com"@example.com is valid [-] Email "very.(),:;<>[]\".VERY.\"very@\ \"very\".unusual"@strange.example.com is NOT valid [-] Email admin@mailserver1 (local domain name with no TLD) is NOT valid [-] Email #!$%&'*+-/=?^_`{}|~@example.org is NOT valid [-] Email "()<>[]:,;@\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org is NOT valid [-] Email " "@example.org (space between the quotes) is NOT valid [-] Email ☃☃☃@example.com (Unicode characters in local part) is NOT valid [-] Email ☃☃☃@☃☃☃.com (Unicode characters in domain part) is NOT valid [+] Email new@domain.pizza is valid
Output for 5.2.0
[+] Email test@example.com is valid [+] Email test.derp@example.com is valid [+] Email test+nick@example.com is valid [-] Email abc."defghi".xyz@example.com is NOT valid [+] Email "abcdefghixyz"@example.com is valid [+] Email jsmith@[192.168.2.1] is valid [-] Email jsmith@[IPv6:2001:db8::1] is NOT valid [+] Email long.but.still.perfectly.valid.email.address@on.even.longer.domain.name.owned.by.some.weird.name.company.which.name.you.cannot.pronounce.com is valid [+] Email other.email-with-dash@example.com is valid [+] Email "much.more unusual"@example.com is valid [-] Email "very.unusual.@.unusual.com"@example.com is NOT valid [-] Email "very.(),:;<>[]\".VERY.\"very@\ \"very\".unusual"@strange.example.com is NOT valid [-] Email admin@mailserver1 (local domain name with no TLD) is NOT valid [-] Email #!$%&'*+-/=?^_`{}|~@example.org is NOT valid [-] Email "()<>[]:,;@\\"!#$%&'*+-/=?^_`{}| ~.a"@example.org is NOT valid [-] Email " "@example.org (space between the quotes) is NOT valid [-] Email ☃☃☃@example.com (Unicode characters in local part) is NOT valid [-] Email ☃☃☃@☃☃☃.com (Unicode characters in domain part) is NOT valid [+] Email new@domain.pizza is valid
Output for 5.0.0 - 5.0.5, 5.1.0 - 5.1.6
Fatal error: Call to undefined function filter_var() in /in/qTsVc on line 26
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: filter_var() in /in/qTsVc on line 26
Process exited with code 255.
Output for 4.3.2 - 4.3.11, 4.4.0 - 4.4.4
Fatal error: Call to undefined function: filter_var() in /in/qTsVc on line 26
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: filter_var() in /in/qTsVc on line 26

preferences:
64.43 ms | 419 KiB | 5 Q