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.40.0040.01219.11
8.3.30.0160.00618.88
8.3.20.0040.00418.90
8.3.10.0050.00320.48
8.3.00.0090.00017.75
8.2.170.0070.01422.96
8.2.160.0100.00322.33
8.2.150.0030.00524.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0050.00319.77
8.2.110.0060.00321.12
8.2.100.0100.00318.09
8.2.90.0000.00819.22
8.2.80.0040.00418.04
8.2.70.0060.00317.63
8.2.60.0050.00318.05
8.2.50.0050.00318.07
8.2.40.0080.00018.22
8.2.30.0040.00418.17
8.2.20.0040.00417.95
8.2.10.0050.00317.98
8.2.00.0080.00017.89
8.1.270.0040.00424.66
8.1.260.0050.00326.35
8.1.250.0000.00728.09
8.1.240.0090.00022.43
8.1.230.0040.00721.02
8.1.220.0030.00518.77
8.1.210.0000.01118.80
8.1.200.0030.00617.38
8.1.190.0040.00417.52
8.1.180.0050.00318.10
8.1.170.0040.00418.77
8.1.160.0040.00418.86
8.1.150.0000.00818.83
8.1.140.0080.00017.48
8.1.130.0000.00718.00
8.1.120.0040.00417.68
8.1.110.0040.00417.56
8.1.100.0000.00817.61
8.1.90.0040.00417.60
8.1.80.0000.00717.57
8.1.70.0000.00717.62
8.1.60.0000.00817.79
8.1.50.0080.00017.67
8.1.40.0100.00017.56
8.1.30.0030.00617.66
8.1.20.0060.00317.79
8.1.10.0000.00817.64
8.1.00.0040.00417.66
8.0.300.0000.00720.15
8.0.290.0080.00016.75
8.0.280.0000.00818.50
8.0.270.0040.00417.24
8.0.260.0000.00817.06
8.0.250.0000.00717.04
8.0.240.0000.00817.04
8.0.230.0030.00317.08
8.0.220.0040.00417.00
8.0.210.0030.00317.09
8.0.200.0030.00317.13
8.0.190.0040.00417.13
8.0.180.0040.00416.98
8.0.170.0030.00517.09
8.0.160.0040.00416.98
8.0.150.0040.00417.11
8.0.140.0000.00817.05
8.0.130.0000.00613.49
8.0.120.0040.00417.00
8.0.110.0070.00017.20
8.0.100.0040.00416.94
8.0.90.0080.00017.14
8.0.80.0040.01117.07
8.0.70.0040.00416.95
8.0.60.0050.00216.98
8.0.50.0040.00417.02
8.0.30.0140.00517.37
8.0.20.0030.01517.27
8.0.10.0040.00416.99
8.0.00.0100.00817.18
7.4.330.0060.00013.23
7.4.320.0070.00016.81
7.4.300.0060.00016.75
7.4.290.0060.00316.83
7.4.280.0090.00016.60
7.4.270.0080.00016.86
7.4.260.0000.00613.52
7.4.250.0060.00316.80
7.4.240.0030.00316.75
7.4.230.0030.00316.88
7.4.220.0060.01616.84
7.4.210.0080.00916.81
7.4.200.0050.00316.96
7.4.190.0040.00416.73
7.4.160.0060.00916.56
7.4.150.0070.01016.55
7.4.140.0120.00916.67
7.4.130.0110.01016.69
7.4.120.0070.01016.66
7.4.110.0170.00716.74
7.4.100.0090.00916.88
7.4.90.0100.01016.89
7.4.80.0060.01116.93
7.4.70.0000.01616.38
7.4.60.0140.00416.59
7.4.50.0000.00416.59
7.4.40.0000.01216.61
7.4.30.0080.00816.87
7.4.00.0080.00915.26
7.3.330.0030.00313.38
7.3.320.0050.00013.22
7.3.310.0030.00316.52
7.3.300.0040.00416.51
7.3.290.0090.00916.44
7.3.280.0090.00816.41
7.3.270.0140.00516.77
7.3.260.0070.01216.75
7.3.250.0120.00816.81
7.3.240.0120.00416.75
7.3.230.0040.01216.57
7.3.210.0060.01316.77
7.3.200.0130.01019.39
7.3.190.0170.00716.41
7.3.180.0120.00416.78
7.3.170.0080.01316.58
7.3.160.0090.01016.93
7.3.120.0080.00915.10
7.3.110.0100.01014.74
7.3.100.0060.00615.20
7.3.90.0000.01014.92
7.3.80.0000.00915.02
7.3.70.0060.00614.82
7.3.60.0000.01314.84
7.3.50.0090.00915.05
7.3.40.0030.01015.05
7.3.30.0080.00415.07
7.3.20.0040.01116.78
7.3.10.0080.00516.84
7.3.00.0070.00716.89
7.2.330.0120.00616.82
7.2.320.0120.00616.87
7.2.310.0180.00616.73
7.2.300.0030.01316.80
7.2.290.0120.00616.91
7.2.250.0000.02015.00
7.2.240.0130.00915.20
7.2.230.0030.00615.26
7.2.220.0070.00315.07
7.2.210.0060.00615.28
7.2.200.0070.00415.04
7.2.190.0060.00615.12
7.2.180.0160.00415.32
7.2.170.0040.01115.21
7.2.130.0070.00616.92
7.2.120.0070.00717.04
7.2.110.0050.00816.96
7.2.100.0050.00817.05
7.2.90.0070.00717.06
7.2.80.0090.00816.86
7.2.70.0030.01116.86
7.2.60.0120.00216.95
7.2.50.0030.01216.98
7.2.40.0040.00716.79
7.2.30.0050.01017.07
7.2.20.0030.01216.92
7.2.10.0030.00716.92
7.2.00.0050.00816.98
7.1.330.0120.00315.96
7.1.320.0110.00315.74
7.1.310.0040.00715.79
7.1.300.0040.01516.02
7.1.290.0080.00415.93
7.1.280.0070.00715.82
7.1.270.0000.01516.11
7.1.260.0030.00816.09
7.1.250.0060.00616.01
7.1.70.0000.00817.28
7.1.60.0130.01019.40
7.1.50.0140.01017.18
7.1.00.0070.07322.41
7.0.200.0000.00816.82
7.0.140.0070.07022.16
7.0.120.0100.06722.09
7.0.60.0100.07019.95
7.0.50.0130.07017.99
7.0.40.0070.04320.44
7.0.30.0530.07020.23
7.0.20.0370.07020.24
7.0.10.0300.07720.25
7.0.00.0100.08020.25
5.6.280.0070.06720.82
5.6.210.0030.08720.62
5.6.200.0070.06718.18
5.6.190.0030.07320.33
5.6.180.0270.07020.63
5.6.170.0130.04720.71
5.6.160.0030.04020.61
5.6.150.0030.08718.24
5.6.140.0100.04318.28
5.6.130.0130.05018.28
5.6.120.0000.04321.16
5.6.110.0070.08721.13
5.6.100.0070.04021.07
5.6.90.0170.07020.98
5.6.80.0030.04020.54
5.6.70.0100.02720.41
5.5.350.0170.07320.44
5.5.340.0070.08317.98
5.5.330.0100.06020.42
5.5.320.0300.08320.27
5.5.310.0170.07720.29
5.5.300.0070.03718.04
5.5.290.0070.08017.95
5.5.280.0070.08320.88
5.5.270.0030.04720.67
5.5.260.0030.09020.88
5.5.250.0130.07020.79
5.5.240.0270.06320.14
5.4.450.0070.04319.31
5.4.440.0130.07319.50
5.4.430.0130.07019.42
5.4.420.0130.06019.31
5.4.410.0070.03719.17
5.4.400.0130.04719.25
5.4.390.0070.04018.88
5.4.380.0070.07718.86
5.4.370.0100.03019.24
5.4.360.0070.03319.15
5.4.350.0030.05719.24
5.4.340.0000.04718.85
5.4.320.0000.04019.24
5.4.310.0130.06319.18
5.4.300.0070.03319.24
5.4.290.0130.06718.97
5.4.280.0030.04319.11
5.4.270.0070.07719.23
5.4.260.0070.03319.14
5.4.250.0100.03018.92
5.4.240.0200.03319.23
5.4.230.0030.05319.11
5.4.220.0030.07319.20
5.4.210.0070.05018.91
5.4.200.0030.04019.26
5.4.190.0000.04719.23
5.4.180.0100.04719.14
5.4.170.0070.07319.00
5.4.160.0070.05319.22
5.4.150.0130.03019.14
5.4.140.0100.09016.46
5.4.130.0070.07016.41
5.4.120.0030.04716.60
5.4.110.0070.04716.39
5.4.100.0030.03316.34
5.4.90.0070.03316.47
5.4.80.0070.07016.41
5.4.70.0030.03316.50
5.4.60.0100.07016.36
5.4.50.0100.03716.65
5.4.40.0000.04716.43
5.4.30.0030.06016.50
5.4.20.0030.06316.38
5.4.10.0030.04316.36
5.4.00.0070.03015.83
5.3.290.0000.06014.59
5.3.280.0070.07714.60
5.3.270.0000.04314.64
5.3.260.0070.07314.67
5.3.250.0130.05314.69
5.3.240.0030.04014.67
5.3.230.0070.07714.66
5.3.220.0030.04314.66
5.3.210.0030.04314.63
5.3.200.0000.04014.63
5.3.190.0030.03714.74
5.3.180.0000.04014.58
5.3.170.0000.04314.63
5.3.160.0030.03714.63
5.3.150.0130.03314.47
5.3.140.0100.06014.59
5.3.130.0030.06314.55
5.3.120.0030.05314.56
5.3.110.0070.05014.63
5.3.100.0100.03314.10
5.3.90.0000.04013.94
5.3.80.0100.03014.03
5.3.70.0100.07314.11
5.3.60.0070.07014.06
5.3.50.0100.06314.00
5.3.40.0030.03714.00
5.3.30.0030.05313.91
5.3.20.0000.04013.86
5.3.10.0030.03313.61
5.3.00.0030.06313.81
5.2.170.0130.05311.11
5.2.160.0000.04311.32
5.2.150.0030.04311.08
5.2.140.0070.03311.14
5.2.130.0000.06311.04
5.2.120.0100.04311.17
5.2.110.0030.06311.11
5.2.100.0070.03711.17
5.2.90.0100.03711.15
5.2.80.0100.05011.11
5.2.70.0030.02711.27
5.2.60.0130.02711.08
5.2.50.0070.06011.19
5.2.40.0070.03011.01
5.2.30.0070.02710.91
5.2.20.0070.05010.98
5.2.10.0100.06010.83
5.2.00.0000.05310.75
5.1.60.0070.0209.98
5.1.50.0030.0379.98
5.1.40.0030.0579.89
5.1.30.0070.03710.31
5.1.20.0030.06010.37
5.1.10.0000.02710.06
5.1.00.0000.03010.23
5.0.50.0000.0239.07
5.0.40.0030.0479.07
5.0.30.0070.0279.07
5.0.20.0000.0309.07
5.0.10.0000.0339.07
5.0.00.0030.0639.07
4.4.90.0000.0409.07
4.4.80.0070.0339.07
4.4.70.0000.0379.07
4.4.60.0000.0179.07
4.4.50.0000.0179.07
4.4.40.0000.0579.07
4.4.30.0000.0309.07
4.4.20.0030.0139.07
4.4.10.0000.0339.07
4.4.00.0030.0279.07
4.3.110.0030.0309.07
4.3.100.0100.0239.07
4.3.90.0030.0179.07
4.3.80.0030.0279.07
4.3.70.0030.0139.07
4.3.60.0030.0139.07
4.3.50.0000.0179.07
4.3.40.0000.0239.07
4.3.30.0000.0179.07
4.3.20.0000.0309.07
4.3.10.0030.0179.07
4.3.00.0000.0179.07

preferences:
44.92 ms | 400 KiB | 5 Q