3v4l.org

run code in 300+ PHP versions simultaneously
<?php //echo is_email('""<script>alert(\'haxxor\')</script>"@domain.com'); echo is_email('"script"@domain.com'); function is_email( $email, $deprecated = false ) { if ( ! empty( $deprecated ) ) _deprecated_argument( __FUNCTION__, '3.0' ); // Test for the minimum length the email can be if ( strlen( $email ) < 3 ) { return 'email_too_short' ; } // Test for an @ character after the first position if ( strpos( $email, '@', 1 ) === false ) { return 'email_no_at' ; } // Split out the local and domain parts list( $local, $domain ) = explode( '@', $email, 2 ); // LOCAL PART // Test for invalid characters if ( !preg_match( '/^[a-zA-Z0-9!#$%&\'*+\/=?^_`{|}~\.-]+$/', $local ) ) { return 'local_invalid_chars' ; } // DOMAIN PART // Test for sequences of periods if ( preg_match( '/\.{2,}/', $domain ) ) { return 'domain_period_sequence'; } // Test for leading and trailing periods and whitespace if ( trim( $domain, " \t\n\r\0\x0B." ) !== $domain ) { return 'domain_period_limits' ; } // Split the domain into subs $subs = explode( '.', $domain ); // Assume the domain will have at least two subs if ( 2 > count( $subs ) ) { return 'domain_no_periods' ; } // Loop through each sub foreach ( $subs as $sub ) { // Test for leading and trailing hyphens and whitespace if ( trim( $sub, " \t\n\r\0\x0B-" ) !== $sub ) { return'sub_hyphen_limits'; } // Test for invalid characters if ( !preg_match('/^[a-z0-9-]+$/i', $sub ) ) { return 'sub_invalid_chars'; } } // Congratulations your email made it! return 'is_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).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0080.00816.49
8.3.50.0180.00922.07
8.3.40.0040.01119.14
8.3.30.0060.00918.92
8.3.20.0050.00320.34
8.3.10.0080.00023.61
8.3.00.0040.00420.93
8.2.180.0110.01116.75
8.2.170.0140.00722.96
8.2.160.0080.00620.31
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0090.00020.86
8.2.110.0030.00622.20
8.2.100.0090.00318.03
8.2.90.0000.00819.17
8.2.80.0000.00917.97
8.2.70.0060.00317.75
8.2.60.0000.00917.68
8.2.50.0040.00418.07
8.2.40.0040.00418.22
8.2.30.0030.00918.30
8.2.20.0000.00817.93
8.2.10.0000.00818.13
8.2.00.0000.00917.93
8.1.280.0120.00925.92
8.1.270.0030.00623.99
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0040.00423.96
8.1.230.0090.00319.23
8.1.220.0040.00417.91
8.1.210.0040.00418.77
8.1.200.0060.00317.48
8.1.190.0040.00417.60
8.1.180.0000.00918.10
8.1.170.0050.00318.75
8.1.160.0000.00822.02
8.1.150.0060.00318.82
8.1.140.0060.00317.64
8.1.130.0000.00717.80
8.1.120.0060.00317.66
8.1.110.0070.00017.67
8.1.100.0040.00417.62
8.1.90.0030.00417.62
8.1.80.0000.00717.54
8.1.70.0050.00317.59
8.1.60.0030.00617.80
8.1.50.0060.00317.64
8.1.40.0040.00417.70
8.1.30.0030.00517.82
8.1.20.0050.00317.75
8.1.10.0040.00417.69
8.1.00.0070.00417.58
8.0.300.0040.00418.77
8.0.290.0040.00417.17
8.0.280.0020.00518.38
8.0.270.0030.00317.23
8.0.260.0070.00017.31
8.0.250.0030.00317.04
8.0.240.0020.00517.03
8.0.230.0030.00517.16
8.0.220.0000.00817.09
8.0.210.0030.00317.05
8.0.200.0070.00017.16
8.0.190.0060.00317.12
8.0.180.0040.00416.98
8.0.170.0000.00717.10
8.0.160.0030.00317.09
8.0.150.0070.00017.07
8.0.140.0000.00717.07
8.0.130.0000.00613.57
8.0.120.0040.00417.06
8.0.110.0000.00717.16
8.0.100.0040.00417.02
8.0.90.0050.00217.09
8.0.80.0060.00917.02
8.0.70.0000.00716.96
8.0.60.0040.00417.13
8.0.50.0040.00416.96
8.0.30.0160.00317.39
8.0.20.0060.01317.61
8.0.10.0070.00017.20
8.0.00.0100.00717.13
7.4.330.0020.00215.07
7.4.320.0000.00616.75
7.4.300.0000.00716.65
7.4.290.0030.00516.76
7.4.280.0050.00316.68
7.4.270.0080.00016.75
7.4.260.0080.00016.83
7.4.250.0040.00416.67
7.4.240.0020.00516.79
7.4.230.0030.00316.95
7.4.220.0030.01416.78
7.4.210.0090.00616.89
7.4.200.0070.00016.79
7.4.190.0070.00016.67
7.4.160.0060.00916.68
7.4.150.0090.00917.40
7.4.140.0140.00517.86
7.4.130.0130.00816.73
7.4.120.0120.00516.73
7.4.110.0110.00716.59
7.4.100.0060.01316.68
7.4.90.0070.01016.66
7.4.80.0090.00919.39
7.4.70.0160.00616.75
7.4.60.0090.00916.64
7.4.50.0000.00616.71
7.4.40.0110.00616.80
7.4.30.0030.01316.87
7.4.00.0130.00415.17
7.3.330.0000.00613.48
7.3.320.0050.00013.26
7.3.310.0040.00416.52
7.3.300.0000.00716.47
7.3.290.0130.00716.47
7.3.280.0070.00916.47
7.3.270.0110.00617.40
7.3.260.0070.01016.72
7.3.250.0060.01116.63
7.3.240.0070.01116.51
7.3.230.0070.01016.67
7.3.210.0070.01016.68
7.3.200.0090.01219.39
7.3.190.0080.00816.84
7.3.180.0090.00616.57
7.3.170.0060.01016.89
7.3.160.0080.00916.54
7.3.120.0050.01314.68
7.3.110.0100.00714.61
7.3.100.0150.00014.74
7.3.90.0060.01214.95
7.3.80.0030.00914.84
7.3.70.0080.00314.75
7.3.60.0030.01415.02
7.3.50.0060.00914.82
7.3.40.0030.01015.08
7.3.30.0100.00614.93
7.3.20.0030.01016.69
7.3.10.0060.00816.90
7.3.00.0060.00916.84
7.2.330.0120.01216.86
7.2.320.0070.01016.77
7.2.310.0000.01716.80
7.2.300.0090.00816.86
7.2.290.0150.00816.68
7.2.250.0130.00715.11
7.2.240.0100.01015.19
7.2.230.0070.00415.26
7.2.220.0060.00915.24
7.2.210.0000.01715.30
7.2.200.0070.01015.30
7.2.190.0130.00315.22
7.2.180.0100.00015.22
7.2.170.0040.00815.24
7.2.130.0030.00617.19
7.2.120.0060.00617.10
7.2.110.0070.00316.92
7.2.100.0100.00317.07
7.2.90.0040.01217.20
7.2.80.0090.00616.86
7.2.70.0060.00916.99
7.2.60.0000.01417.10
7.2.50.0070.00416.91
7.2.40.0040.01117.21
7.2.30.0040.00717.10
7.2.20.0060.00916.86
7.2.10.0070.00717.14
7.2.00.0020.01218.16
7.1.330.0060.00715.68
7.1.320.0040.00716.12
7.1.310.0140.00015.92
7.1.300.0130.00316.04
7.1.290.0100.00015.69
7.1.280.0080.00615.86
7.1.270.0000.01215.96
7.1.260.0040.01216.13
7.1.250.0040.00715.89
7.1.100.0030.00918.14
7.1.70.0190.00617.38
7.1.60.0030.02119.70
7.1.50.0070.01417.20
7.1.00.0030.07722.46
7.0.200.0030.00316.80
7.0.140.0070.07022.07
7.0.60.0030.07721.56
7.0.50.0070.07717.96
7.0.40.0070.04720.13
7.0.30.0300.09020.36
7.0.20.0200.08320.26
7.0.10.0030.06020.17
7.0.00.0000.08020.27
5.6.280.0000.07720.93
5.6.210.0130.06720.57
5.6.200.0130.08318.18
5.6.190.0130.08020.64
5.6.180.0230.07720.48
5.6.170.0330.07720.51
5.6.160.0100.08020.48
5.6.150.0070.06718.27
5.6.140.0070.05318.17
5.6.130.0000.08018.20
5.6.120.0070.05721.00
5.6.110.0100.08021.13
5.6.100.0030.08720.90
5.6.90.0100.04021.05
5.6.80.0270.06720.39
5.5.350.0030.04020.32
5.5.340.0070.08018.07
5.5.330.0070.08320.30
5.5.320.0170.05020.34
5.5.310.0230.08020.27
5.5.300.0070.07718.08
5.5.290.0130.07017.93
5.5.280.0030.06720.66
5.5.270.0070.08320.78
5.5.260.0170.08020.67
5.5.250.0070.09020.60
5.5.240.0130.08020.30
5.4.450.0070.08319.41
5.4.440.0130.07319.56
5.4.430.0230.06319.24
5.4.420.0170.07019.30
5.4.410.0000.04719.27
5.4.400.0070.07719.20
5.4.390.0130.06719.17
5.4.380.0070.05019.01
5.4.370.0100.07318.85
5.4.360.0070.06018.93
5.4.350.0130.07318.89
5.4.340.0070.07719.25
5.4.320.0100.07318.85
5.4.310.0100.04018.85
5.4.300.0070.07318.87
5.4.290.0000.04718.88
5.4.280.0030.08319.24
5.4.270.0030.07719.24
5.4.260.0070.03718.83
5.4.250.0070.05019.20
5.4.240.0070.06719.24
5.4.230.0030.05718.99
5.4.220.0070.06719.13
5.4.210.0000.06019.15
5.4.200.0170.06719.19
5.4.190.0070.05318.91
5.4.180.0000.04019.14
5.4.170.0070.03318.91
5.4.160.0000.04019.14
5.4.150.0000.04019.06
5.4.140.0070.03316.50
5.4.130.0030.03716.35
5.4.120.0070.03016.49
5.4.110.0000.03716.53
5.4.100.0030.05016.45
5.4.90.0130.03016.43
5.4.80.0070.03316.46
5.4.70.0070.03016.42
5.4.60.0000.03716.51
5.4.50.0070.03016.43
5.4.40.0070.03016.40
5.4.30.0000.04016.39
5.4.20.0070.03016.38
5.4.10.0070.03016.50
5.4.00.0030.03315.71
5.3.290.0070.07714.73
5.3.280.0030.05314.65
5.3.270.0030.03714.52
5.3.260.0100.03714.62
5.3.250.0070.03314.64
5.3.240.0030.03714.62
5.3.230.0030.03714.64
5.3.220.0030.04014.50
5.3.210.0000.04014.61
5.3.200.0030.03714.74
5.3.190.0070.03314.64
5.3.180.0000.04014.47
5.3.170.0000.04714.59
5.3.160.0070.03714.64
5.3.150.0000.04014.50
5.3.140.0100.03014.57
5.3.130.0030.03714.56
5.3.120.0070.03314.45
5.3.110.0100.03014.55
5.3.100.0070.03314.09
5.3.90.0030.04013.94
5.3.80.0000.04014.02
5.3.70.0000.03714.09
5.3.60.0000.04014.01
5.3.50.0030.03313.88
5.3.40.0030.04014.11
5.3.30.0030.03313.95
5.3.20.0030.03713.78
5.3.10.0000.04013.71
5.3.00.0000.03713.66
5.2.170.0000.03011.11
5.2.160.0000.03011.22
5.2.150.0100.02311.20
5.2.140.0030.03011.12
5.2.130.0030.02711.06
5.2.120.0000.03011.08
5.2.110.0070.02311.04
5.2.100.0030.02711.19
5.2.90.0030.02711.13
5.2.80.0070.02311.27
5.2.70.0070.02711.07
5.2.60.0030.03311.07
5.2.50.0070.06011.07
5.2.40.0000.05711.09
5.2.30.0000.03310.99
5.2.20.0000.03311.01
5.2.10.0030.05010.88
5.2.00.0000.06710.65
5.1.60.0000.0409.91
5.1.50.0030.0539.98
5.1.40.0030.04710.05
5.1.30.0030.04010.36
5.1.20.0070.05310.29
5.1.10.0030.05710.02
5.1.00.0000.02710.23
5.0.50.0070.0208.58
5.0.40.0000.0338.40
5.0.30.0000.0478.23
5.0.20.0000.0478.23
5.0.10.0000.0408.10
5.0.00.0000.0478.18
4.4.90.0030.0137.84
4.4.80.0030.0177.84
4.4.70.0100.0207.84
4.4.60.0030.0237.84
4.4.50.0000.0337.84
4.4.40.0030.0577.84
4.4.30.0030.0237.84
4.4.20.0070.0207.84
4.4.10.0030.0177.84
4.4.00.0030.0237.84
4.3.110.0070.0177.84
4.3.100.0000.0377.84
4.3.90.0000.0277.84
4.3.80.0030.0237.84
4.3.70.0030.0207.84
4.3.60.0000.0377.84
4.3.50.0030.0377.84
4.3.40.0000.0477.84
4.3.30.0030.0277.84
4.3.20.0000.0207.84
4.3.10.0000.0377.84
4.3.00.0000.0377.84

preferences:
38.69 ms | 401 KiB | 5 Q