3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo valid_email('hhh@qq.com'); function valid_email($email) { //有且只有一个@,且不以@开头和结尾 if(!preg_match("/^[^@]{1,64}@[^@]{1,255}$/", $email)) { return false; } $email_array = explode("@", $email); $local_array = explode(".", $email_array[0]); for($i = 0; $i < sizeof($local_array); $i++) { if (!preg_match("/^(([A-Za-z0-9!#$%&'*+\/=?^_`{|}~-][A-Za-z0-9!#$%&'*+\/=?^_`{|}~\.-]{0,63})|(\"[^(\\|\")]{0,62}\"))$/", $local_array[$i])) { return false; } } if(!preg_match("/^\[?[0-9\.]+\]?$/", $email_array[1])) { //检查域名合法性 $domain_array = explode(".", $email_array[1]); if (sizeof($domain_array) < 2) { return false; } for ($i = 0; $i < sizeof($domain_array); $i++) { if (!preg_match("/^(([A-Za-z0-9][A-Za-z0-9-]{0,61}[A-Za-z0-9])|([A-Za-z0-9]+))$/", $domain_array[$i])) { return false; } } } return true; }
Output for git.master, git.master_jit, rfc.property-hooks
1

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
38.09 ms | 401 KiB | 8 Q