3v4l.org

run code in 300+ PHP versions simultaneously
<?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')); }
Output for 8.1.0 - 8.1.27, 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
Warning: Undefined variable $_email in /in/m1pU3 on line 14 Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in /in/m1pU3 on line 14 Warning: Undefined array key 2 in /in/m1pU3 on line 19 Deprecated: idn_to_ascii(): Passing null to parameter #1 ($domain) of type string is deprecated in /in/m1pU3 on line 19 Fatal error: Uncaught ValueError: checkdnsrr(): Argument #1 ($hostname) cannot be empty in /in/m1pU3:19 Stack trace: #0 /in/m1pU3(19): checkdnsrr('', 'MX') #1 /in/m1pU3(5): checkEmailAndDomain('geradolson5656@...') #2 {main} thrown in /in/m1pU3 on line 19
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
Warning: Undefined variable $_email in /in/m1pU3 on line 14 Warning: Undefined array key 2 in /in/m1pU3 on line 19 Fatal error: Uncaught ValueError: checkdnsrr(): Argument #1 ($hostname) cannot be empty in /in/m1pU3:19 Stack trace: #0 /in/m1pU3(19): checkdnsrr('', 'MX') #1 /in/m1pU3(5): checkEmailAndDomain('geradolson5656@...') #2 {main} thrown in /in/m1pU3 on line 19
Process exited with code 255.
Output for 8.0.13
Warning: 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 7.4.33
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.5.0 - 5.5.38, 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
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.3.32 - 7.3.33
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.4.0 - 5.4.45
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.

preferences:
259.92 ms | 401 KiB | 369 Q