3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php var_dump(filter_var('nonsense.something@dottiness', FILTER_VALIDATE_EMAIL)); var_dump(filter_var('dotty@something.whatever', FILTER_VALIDATE_EMAIL)); var_dump(filter_var('foo..bar@gmail.com', FILTER_VALIDATE_EMAIL)); var_dump(filter_var('fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo@gmail.com', FILTER_VALIDATE_EMAIL)); var_dump(filter_var('"Foo Bar"@gmail.com', FILTER_VALIDATE_EMAIL)); // should be valid var_dump(filter_var('email@com', FILTER_VALIDATE_EMAIL)); // should be valid var_dump(filter_var('user@localmachine', FILTER_VALIDATE_EMAIL)); // should be valid var_dump(filter_var('localuser', FILTER_VALIDATE_EMAIL)); // should be valid var_dump(filter_var('foo.@bar.com', FILTER_VALIDATE_EMAIL)); // should be INvalid
Output for 5.2.14 - 5.2.17, 5.3.3 - 7.1.0
bool(false) string(24) "dotty@something.whatever" bool(false) bool(false) bool(false) bool(false) bool(false) bool(false) bool(false)
Output for 5.2.9 - 5.2.13, 5.3.0 - 5.3.2
string(28) "nonsense.something@dottiness" string(24) "dotty@something.whatever" string(18) "foo..bar@gmail.com" string(88) "fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo@gmail.com" string(19) ""Foo Bar"@gmail.com" string(9) "email@com" string(17) "user@localmachine" bool(false) string(12) "foo.@bar.com"
Output for 5.2.0 - 5.2.8
bool(false) string(24) "dotty@something.whatever" bool(false) string(88) "fooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo@gmail.com" string(19) ""Foo Bar"@gmail.com" bool(false) bool(false) bool(false) bool(false)
Output for 5.0.0 - 5.0.5, 5.1.1 - 5.1.6
Fatal error: Call to undefined function filter_var() in /in/nonZc on line 3
Process exited with code 255.
Output for 5.1.0
Fatal error: fatal flex scanner internal error--end of buffer missed in /in/nonZc on line 11
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: filter_var() in /in/nonZc on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: filter_var() in /in/nonZc on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: filter_var() in /in/nonZc on line 3