3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php function validEmail($email) { $isValid = true; $atIndex = strrpos($email, "@"); if (is_bool($atIndex) && !$atIndex) { $isValid = false; } else { $domain = substr($email, $atIndex+1); $local = substr($email, 0, $atIndex); $localLen = strlen($local); $domainLen = strlen($domain); if ($localLen < 1 || $localLen > 64) { // local part length exceeded $isValid = false; } else if ($domainLen < 1 || $domainLen > 255) { // domain part length exceeded $isValid = false; } else if ($local[0] == '.' || $local[$localLen-1] == '.') { // local part starts or ends with '.' $isValid = false; } else if (preg_match('/\\.\\./', $local)) { // local part has two consecutive dots $isValid = false; } else if (!preg_match('/^[A-Za-z0-9\\-\\.]+$/', $domain)) { // character not valid in domain part $isValid = false; } else if (preg_match('/\\.\\./', $domain)) { // domain part has two consecutive dots $isValid = false; } else if (!preg_match('/^(\\\\.|[A-Za-z0-9!#%&`_=\\/$\'*+?^{}|~.-])+$/', str_replace("\\\\","",$local))) { // character not valid in local part unless // local part is quoted if (!preg_match('/^"(\\\\"|[^"])+"$/', str_replace("\\\\","",$local))) { $isValid = false; } } if ($isValid && !(checkdnsrr($domain,"MX") || checkdnsrr($domain,"A"))) { // domain not found in DNS $isValid = false; } } return $isValid; } $email = 's+s@ged.de'; var_dump(validEmail($email));

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Note: hhvm uses a JIT which only kicks in after a few runs. Since we run scripts only once, hhvm always runs slower.

VersionSystem time (s)User time (s)Memory (MiB)
7.2.00.0110.00719.35
7.1.100.0080.00018.30
7.1.70.0000.00817.46
7.1.60.0000.01519.82
7.1.50.0100.01317.20
7.1.00.0030.07722.46
7.0.200.0140.00017.05
7.0.140.0000.06722.15
7.0.60.0130.07320.06
7.0.50.0070.03718.00
7.0.40.0170.07320.26
7.0.30.0330.07320.18
7.0.20.0300.05020.19
7.0.10.0300.08320.19
7.0.00.0000.04720.22
5.6.280.0030.07321.13
5.6.210.0000.08720.73
5.6.200.0100.08318.28
5.6.190.0070.06320.63
5.6.180.0270.06720.54
5.6.170.0330.05720.63
5.6.160.0130.08020.70
5.6.150.0070.03718.24
5.6.140.0030.04018.43
5.6.130.0070.07018.22
5.6.120.0130.03320.96
5.6.110.0100.09021.12
5.6.100.0000.06721.15
5.6.90.0130.08021.15
5.6.80.0130.06320.46
5.6.70.0300.07020.54
5.5.350.0230.05320.44
5.5.340.0030.08318.18
5.5.330.0100.03720.51
5.5.320.0270.06720.51
5.5.310.0270.05320.44
5.5.300.0030.05018.03
5.5.290.0130.08018.04
5.5.280.0030.08320.95
5.5.270.0100.08020.87
5.5.260.0070.08320.89
5.5.250.0230.06720.57
5.5.240.0070.08020.26
5.4.450.0800.05319.79
5.4.440.0870.04719.55
5.4.430.0830.05019.40
5.4.420.0730.05019.63
5.4.410.0030.07719.06
5.4.400.0870.00018.95
5.4.390.0830.00018.82
5.4.380.0370.05018.87
5.4.370.0200.05018.70
5.4.360.0200.05018.86
5.4.350.0200.05018.79
5.4.340.0230.04718.93
5.4.320.0060.03812.57
5.4.310.0070.04312.56
5.4.300.0060.03912.57
5.4.290.0070.04512.57
5.4.280.0090.04112.46
5.4.270.0000.06019.05
5.4.260.0030.08318.76
5.4.250.0170.04318.88
5.4.240.0200.05019.07
5.4.230.0200.04019.05
5.4.220.0200.06019.03
5.4.210.0130.07318.88
5.4.200.0170.06718.88
5.4.190.0130.04718.79
5.4.180.0130.06719.04
5.4.170.0100.06319.04
5.4.160.0170.05019.06
5.4.150.0130.05718.83
5.4.140.0130.07016.56
5.4.130.0030.06016.49
5.4.120.0170.06316.60
5.4.110.0170.05016.76
5.4.100.0070.05316.57
5.4.90.0130.04316.70
5.4.80.0070.06016.75
5.4.70.0170.06316.48
5.4.60.0070.07016.71
5.4.50.0130.05016.44
5.4.40.0070.05016.47
5.4.30.0130.05016.61
5.4.20.0100.04716.57
5.4.10.0130.05016.54
5.4.00.0030.06015.85
5.3.290.0100.04112.83
5.3.280.0200.04314.78
5.3.270.0130.07014.73
5.3.260.0230.04314.61
5.3.250.0130.04714.73
5.3.240.0100.04714.81
5.3.230.0100.05014.72
5.3.220.0100.05314.69
5.3.210.0230.06014.66
5.3.200.0100.06314.61
5.3.190.0230.03714.44
5.3.180.0200.04014.61
5.3.170.0170.06314.62
5.3.160.0070.07314.68
5.3.150.0070.06014.59
5.3.140.0100.04714.68
5.3.130.0070.05714.61
5.3.120.0170.05014.67
5.3.110.0100.06014.72
5.3.100.0200.06013.91
5.3.90.0070.05014.06
5.3.80.0030.05314.06
5.3.70.0070.05714.03
5.3.60.0130.04314.23
5.3.50.0100.04314.00
5.3.40.0000.05713.98
5.3.30.0130.04313.78
5.3.20.0130.04313.80
5.3.10.0070.07013.66
5.3.00.0130.04313.76
5.2.170.0130.04011.35
5.2.160.0100.05711.41
5.2.150.0030.05011.09
5.2.140.0130.04011.27
5.2.130.0030.04011.15
5.2.120.0030.05711.23
5.2.110.0000.04311.04
5.2.100.0100.05311.11
5.2.90.0130.03311.30
5.2.80.0030.04311.29
5.2.70.0030.05311.11
5.2.60.0100.05311.17
5.2.50.0030.04311.22
5.2.40.0030.04711.04
5.2.30.0070.04311.18
5.2.20.0130.05010.98
5.2.10.0000.04310.88
5.2.00.0070.04310.66
5.1.60.0100.04310.14
5.1.50.0130.04010.09
5.1.40.0030.0539.98
5.1.30.0100.03010.36
5.1.20.0030.04010.23
5.1.10.0030.04010.08
5.1.00.0070.03710.16
5.0.50.0000.0308.68
5.0.40.0130.0178.47
5.0.30.0070.0378.10
5.0.20.0000.0308.22
5.0.10.0000.0308.18
5.0.00.0100.0378.20
4.4.90.0030.0237.06
4.4.80.0000.0237.06
4.4.70.0070.0177.06
4.4.60.0030.0277.06
4.4.50.0070.0237.06
4.4.40.0100.0307.06
4.4.30.0030.0207.28
4.4.20.0030.0237.28
4.4.10.0030.0237.28
4.4.00.0030.0337.28
4.3.110.0030.0237.28
4.3.100.0030.0307.28
4.3.90.0070.0277.28
4.3.80.0100.0277.28
4.3.70.0000.0277.28
4.3.60.0030.0307.28
4.3.50.0070.0207.28
4.3.40.0070.0307.27
4.3.30.0070.0207.27
4.3.20.0000.0277.27
4.3.10.0030.0307.27
4.3.00.0170.0176.88