3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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; ?>
based on Mi3NH
Output for 7.0.0 - 7.0.4, 7.0.6 - 7.2.0
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 7.0.5
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 5.4.9 - 5.5.28, 5.5.31 - 5.5.33, 5.5.35 - 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.3.19 - 5.3.29, 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.