3v4l.org

run code in 300+ PHP versions simultaneously
<?php $pattern = '/^[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&\'*+\\/=?^_`{|}~-]+)*@(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?\.)+[a-zA-Z0-9](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$/'; preg_match('/^(.*<?)(.*)@(.*?)(>?)$/', 'philipptschiönder@dörler.co.at', $matches); var_dump($matches); $value = $matches[1] . idn_to_ascii($matches[2]) . '@' . idn_to_ascii($domain) . $matches[4]; $valid = preg_match($this->pattern, $value) || $this->allowName && preg_match($this->fullPattern, $value); echo $valid; ?>
Output for 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Warning: Undefined variable $domain in /in/PBo98 on line 6 Deprecated: idn_to_ascii(): Passing null to parameter #1 ($domain) of type string is deprecated in /in/PBo98 on line 6 Fatal error: Uncaught Error: Using $this when not in object context in /in/PBo98:7 Stack trace: #0 {main} thrown in /in/PBo98 on line 7
Process exited with code 255.
Output for 8.0.0 - 8.0.12, 8.0.14 - 8.0.30
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Warning: Undefined variable $domain in /in/PBo98 on line 6 Fatal error: Uncaught Error: Using $this when not in object context in /in/PBo98:7 Stack trace: #0 {main} thrown in /in/PBo98 on line 7
Process exited with code 255.
Output for 7.0.5, 7.3.32 - 7.3.33, 7.4.33, 8.0.13
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Fatal error: Uncaught Error: Call to undefined function idn_to_ascii() in /in/PBo98:6 Stack trace: #0 {main} thrown in /in/PBo98 on line 6
Process exited with code 255.
Output for 7.0.0 - 7.0.4, 7.0.6 - 7.0.20, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.31, 7.4.0 - 7.4.32
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Notice: Undefined variable: domain in /in/PBo98 on line 6 Fatal error: Uncaught Error: Using $this when not in object context in /in/PBo98:7 Stack trace: #0 {main} thrown in /in/PBo98 on line 7
Process exited with code 255.
Output for 5.5.24 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35, 5.6.8 - 5.6.12, 5.6.16 - 5.6.19, 5.6.21 - 5.6.28
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Notice: Undefined variable: domain in /in/PBo98 on line 6 Fatal error: Using $this when not in object context in /in/PBo98 on line 7
Process exited with code 255.
Output for 5.5.29 - 5.5.30, 5.5.34, 5.6.13 - 5.6.15, 5.6.20
array(5) { [0]=> string(32) "philipptschiönder@dörler.co.at" [1]=> string(18) "philipptschiönder" [2]=> string(0) "" [3]=> string(13) "dörler.co.at" [4]=> string(0) "" } Fatal error: Call to undefined function idn_to_ascii() in /in/PBo98 on line 6
Process exited with code 255.

preferences:
187.87 ms | 402 KiB | 229 Q