3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $email = 'geradolson5656@gmail.com'; if (checkEmailAndDomain($email)) { echo 'Yes'; } else { echo 'No'; } function checkEmailAndDomain($email) { $exp = "/^(.*)@(.*)$/"; preg_match($exp, $_email, $matches); if (!empty($matches[1]) and (!filter_var($_email, FILTER_VALIDATE_EMAIL))) return (false); return (checkdnsrr(idn_to_ascii($matches[2]), 'MX')); }
based on 3hJk0
Output for 5.4.0 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35 - 5.6.12, 5.6.16 - 5.6.19, 5.6.21 - 7.0.4, 7.0.6 - 7.2.0
Notice: Undefined variable: _email in /in/m1pU3 on line 14 Notice: Undefined offset: 2 in /in/m1pU3 on line 19 Warning: checkdnsrr(): Host cannot be empty in /in/m1pU3 on line 19 No
Output for 7.0.5
Notice: Undefined variable: _email in /in/m1pU3 on line 14 Fatal error: Uncaught Error: Call to undefined function idn_to_ascii() in /in/m1pU3:19 Stack trace: #0 /in/m1pU3(5): checkEmailAndDomain('geradolson5656@...') #1 {main} thrown in /in/m1pU3 on line 19
Process exited with code 255.
Output for 5.3.18 - 5.3.29, 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
Notice: Undefined variable: _email in /in/m1pU3 on line 14 Fatal error: Call to undefined function idn_to_ascii() in /in/m1pU3 on line 19
Process exited with code 255.