3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $user_email = "dbutt@westminstertoyota.com"; $allowed_domain = '/^[^@]+@[^@]*toyota[^@]*\.[^@]+/'; preg_match($allowed_domain, $user_email, $matches); print_r($matches); $regex = preg_quote($allowed_domain, '#') . '$'; if (preg_match("#$regex#i", $user_email) or preg_match($pattern, $allowed_domain)) { echo 'True'; }else{ echo 'False'; }
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Array ( [0] => dbutt@westminstertoyota.com ) Notice: Undefined variable: pattern in /in/qgFRo on line 10 Warning: preg_match(): Empty regular expression in /in/qgFRo on line 10 False
Output for hhvm-3.12.0
Array ( [0] => dbutt@westminstertoyota.com ) Notice: Undefined variable: pattern in /in/qgFRo on line 10 Warning: preg_match() expects parameter 1 to be string, null given in /in/qgFRo on line 10 False
Output for hhvm-3.10.0
Array ( [0] => dbutt@westminstertoyota.com ) Notice: Undefined variable: pattern in /in/qgFRo on line 10 Warning: Empty regular expression in /in/qgFRo on line 10 False
Output for 4.3.11 - 5.0.3
Array ( [0] => dbutt@westminstertoyota.com ) Notice: Undefined variable: pattern in /in/qgFRo on line 10 Warning: preg_match(): Empty regular expression in /in/qgFRo on line 10 False
Output for 4.3.0 - 4.3.10
Array ( [0] => dbutt@westminstertoyota.com ) Notice: Undefined variable: pattern in /in/qgFRo on line 10 Warning: Empty regular expression in /in/qgFRo on line 10 False