3v4l.org

run code in 300+ PHP versions simultaneously
<?php //echo is_email('""<script>alert(\'haxxor\')</script>"@domain.com'); echo is_email('<script></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.0000.01618.96
8.3.30.0140.00018.96
8.3.20.0100.00618.90
8.3.10.0050.00520.79
8.3.00.0000.01217.63
8.2.170.0090.00622.96
8.2.160.0070.00720.35
8.2.150.0060.00324.18
8.2.140.0090.00024.66
8.2.130.0070.00026.16
8.2.120.0030.00519.36
8.2.110.0070.00421.12
8.2.100.0030.00918.16
8.2.90.0050.00319.21
8.2.80.0040.00417.97
8.2.70.0030.00617.75
8.2.60.0070.00417.80
8.2.50.0060.00318.07
8.2.40.0030.00518.17
8.2.30.0020.00518.31
8.2.20.0000.00817.91
8.2.10.0070.00017.92
8.2.00.0090.00317.80
8.1.270.0000.00724.66
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0090.00021.41
8.1.230.0080.00417.61
8.1.220.0090.00017.74
8.1.210.0030.00518.77
8.1.200.0060.00317.60
8.1.190.0040.00417.47
8.1.180.0000.00818.10
8.1.170.0040.00418.90
8.1.160.0040.00418.98
8.1.150.0000.00818.70
8.1.140.0000.00917.72
8.1.130.0070.00017.87
8.1.120.0050.00317.62
8.1.110.0040.00417.55
8.1.100.0040.00417.64
8.1.90.0040.00417.63
8.1.80.0080.00017.57
8.1.70.0000.00717.67
8.1.60.0040.00417.77
8.1.50.0060.00317.50
8.1.40.0050.00317.74
8.1.30.0040.00417.75
8.1.20.0040.00417.80
8.1.10.0030.00517.74
8.1.00.0000.00817.68
8.0.300.0040.00418.77
8.0.290.0030.00616.88
8.0.280.0030.00318.50
8.0.270.0040.00417.19
8.0.260.0000.00716.94
8.0.250.0000.00817.05
8.0.240.0090.00017.15
8.0.230.0000.00717.16
8.0.220.0000.00816.97
8.0.210.0050.00216.96
8.0.200.0030.00317.15
8.0.190.0070.00017.19
8.0.180.0040.00417.15
8.0.170.0040.00417.13
8.0.160.0000.00817.05
8.0.150.0000.00817.01
8.0.140.0030.00816.96
8.0.130.0030.00313.42
8.0.120.0070.00016.90
8.0.110.0030.00617.02
8.0.100.0080.00017.11
8.0.90.0000.00716.93
8.0.80.0100.01417.04
8.0.70.0030.00517.02
8.0.60.0040.00416.95
8.0.50.0000.00816.91
8.0.30.0120.00717.06
8.0.20.0130.00716.97
8.0.10.0000.00817.09
8.0.00.0110.00916.84
7.4.330.0060.00013.12
7.4.320.0100.00016.76
7.4.300.0000.00616.77
7.4.290.0030.00316.75
7.4.280.0040.00416.73
7.4.270.0000.00716.64
7.4.260.0030.00313.46
7.4.250.0000.00916.79
7.4.240.0000.00716.84
7.4.230.0000.00716.87
7.4.220.0100.01016.81
7.4.210.0100.00816.87
7.4.200.0080.00016.83
7.4.190.0000.00716.95
7.4.160.0130.00316.94
7.4.150.0070.01116.63
7.4.140.0090.00916.64
7.4.130.0080.00816.88
7.4.120.0090.01216.71
7.4.110.0140.00316.68
7.4.100.0110.00716.84
7.4.90.0130.01016.82
7.4.80.0130.00319.39
7.4.70.0070.01016.88
7.4.60.0050.01616.82
7.4.50.0000.00916.75
7.4.40.0090.00016.63
7.4.30.0120.00316.77
7.4.10.0130.00315.18
7.4.00.0090.00815.22
7.3.330.0000.00713.46
7.3.320.0000.00613.32
7.3.310.0000.00716.52
7.3.300.0070.00016.43
7.3.290.0060.01316.40
7.3.280.0060.01216.48
7.3.270.0100.00716.53
7.3.260.0180.00016.75
7.3.250.0100.00916.67
7.3.240.0070.01016.82
7.3.230.0060.01016.50
7.3.210.0030.01316.45
7.3.200.0040.01616.73
7.3.190.0160.00716.71
7.3.180.0060.01016.50
7.3.170.0070.01016.64
7.3.160.0060.01116.61
7.3.130.0100.01014.91
7.3.120.0070.00915.02
7.3.110.0120.00315.00
7.3.100.0090.00315.23
7.3.90.0050.00514.78
7.3.80.0060.00615.25
7.3.70.0030.00614.82
7.3.60.0030.00715.11
7.3.50.0000.01314.92
7.3.40.0090.00014.86
7.3.30.0070.00715.02
7.3.20.0090.00916.70
7.3.10.0080.00616.73
7.3.00.0100.00416.70
7.2.330.0130.00616.73
7.2.320.0110.00816.85
7.2.310.0130.01016.68
7.2.300.0070.01016.78
7.2.290.0090.00616.94
7.2.260.0090.00915.30
7.2.250.0110.00714.87
7.2.240.0070.00715.27
7.2.230.0070.00714.95
7.2.220.0040.01515.04
7.2.210.0030.01015.06
7.2.200.0040.01115.19
7.2.190.0000.01115.24
7.2.180.0030.00615.39
7.2.170.0030.00615.18
7.2.160.0090.00615.15
7.2.150.0100.00717.23
7.2.140.0060.00317.10
7.2.130.0060.00516.90
7.2.120.0040.01116.88
7.2.110.0060.00917.04
7.2.100.0080.00716.90
7.2.90.0080.00816.95
7.2.80.0070.00917.10
7.2.70.0070.00816.83
7.2.60.0030.01117.01
7.2.50.0040.00817.03
7.2.40.0050.00717.08
7.2.30.0070.00517.13
7.2.20.0050.00816.97
7.2.10.0050.00817.09
7.2.00.0040.01017.76
7.1.330.0070.00715.93
7.1.320.0030.00716.11
7.1.310.0030.01015.94
7.1.300.0040.01115.73
7.1.290.0060.00915.51
7.1.280.0040.00815.92
7.1.270.0040.01115.96
7.1.260.0060.00315.68
7.1.250.0060.00715.93
7.1.240.0060.00815.72
7.1.230.0050.00915.95
7.1.220.0060.00715.96
7.1.210.0030.01215.99
7.1.200.0060.00615.78
7.1.190.0050.00915.95
7.1.180.0020.01115.80
7.1.170.0020.00915.88
7.1.160.0020.01315.86
7.1.150.0030.01215.82
7.1.140.0020.01215.85
7.1.130.0020.00715.81
7.1.120.0080.00715.89
7.1.110.0060.00515.85
7.1.100.0050.00916.69
7.1.90.0020.01216.05
7.1.80.0070.00815.90
7.1.70.0020.01016.32
7.1.60.0010.01417.08
7.1.50.0050.01116.41
7.1.40.0050.00715.96
7.1.30.0050.00815.76
7.1.20.0040.01015.95
7.1.10.0070.00515.85
7.1.00.0030.03018.06
7.0.330.0060.00415.40
7.0.320.0050.01015.40
7.0.310.0080.00515.46
7.0.300.0080.00515.44
7.0.290.0040.00815.54
7.0.280.0060.00415.55
7.0.270.0060.00715.37
7.0.260.0040.00615.45
7.0.250.0000.01215.54
7.0.240.0040.00615.55
7.0.230.0030.00615.48
7.0.220.0030.00615.72
7.0.210.0060.00415.59
7.0.200.0050.00715.98
7.0.190.0070.00715.68
7.0.180.0050.00615.37
7.0.170.0070.00415.45
7.0.160.0010.01015.67
7.0.150.0070.00715.73
7.0.140.0070.02717.69
7.0.130.0050.00915.51
7.0.120.0060.02917.75
7.0.110.0030.01015.41
7.0.100.0060.00315.64
7.0.90.0090.00615.68
7.0.80.0050.00915.74
7.0.70.0020.01015.65
7.0.60.0070.01417.02
7.0.50.0060.01816.37
7.0.40.0070.01815.88
7.0.30.0130.03415.72
7.0.20.0160.02315.85
7.0.10.0040.03315.85
7.0.00.0020.02215.91
5.6.400.0080.00314.73
5.6.390.0000.01114.67
5.6.380.0060.00614.51
5.6.370.0020.01314.18
5.6.360.0080.00214.67
5.6.350.0060.00714.66
5.6.340.0050.00714.69
5.6.330.0050.00714.50
5.6.320.0080.00614.46
5.6.310.0060.00614.58
5.6.300.0030.00914.55
5.6.290.0050.01114.47
5.6.280.0030.03016.63
5.6.270.0080.00814.48
5.6.260.0080.00514.56
5.6.250.0050.00614.24
5.6.240.0060.00814.58
5.6.230.0050.00814.49
5.6.220.0060.00614.47
5.6.210.0060.01716.52
5.6.200.0050.02515.68
5.6.190.0060.01716.37
5.6.180.1310.01916.53
5.6.170.0110.02216.46
5.6.160.0050.02916.52
5.6.150.0040.01715.57
5.6.140.0030.02215.70
5.6.130.0040.02815.70
5.6.120.0040.02416.65
5.6.110.0060.03216.52
5.6.100.0060.01716.73
5.6.90.0110.02816.47
5.6.80.0060.01416.35
5.6.70.0080.00514.26
5.6.60.0040.00814.26
5.6.50.0030.00814.44
5.6.40.0060.00614.61
5.6.30.0060.00714.45
5.6.20.0070.00714.47
5.6.10.0060.00914.29
5.6.00.0070.00814.37
5.5.380.0030.01112.84
5.5.370.0030.00913.05
5.5.360.0080.00512.84
5.5.350.0140.02915.33
5.5.340.0090.01414.48
5.5.330.0070.03115.25
5.5.320.0070.03415.35
5.5.310.0110.01815.34
5.5.300.0060.02514.54
5.5.290.0100.01514.58
5.5.280.0120.02515.51
5.5.270.0030.03115.51
5.5.260.0090.03015.49
5.5.250.0060.01815.35
5.5.240.0050.02815.30
5.5.230.0050.00812.84
5.5.220.0040.00812.79
5.5.210.0010.01112.60
5.5.200.0050.00812.81
5.5.190.0060.00712.80
5.5.180.0020.01112.64
5.5.170.0050.00612.77
5.5.160.0070.00312.65
5.5.150.0090.00412.68
5.5.140.0020.00912.74
5.5.130.0090.00312.60
5.5.120.0030.01012.85
5.5.110.0090.00312.79
5.5.100.0020.00912.74
5.5.90.0090.00212.77
5.5.80.0020.00912.88
5.5.70.0020.01012.95
5.5.60.0020.01112.72
5.5.50.0040.01012.74
5.5.40.0030.00812.83
5.5.30.0010.00812.94
5.5.20.0040.01012.87
5.5.10.0080.00312.63
5.5.00.0080.00612.73
5.4.450.0060.01813.98
5.4.440.0040.02014.15
5.4.430.0080.02713.75
5.4.420.0090.02213.96
5.4.410.0030.02313.88
5.4.400.0070.02813.76
5.4.390.0060.01613.89
5.4.380.0030.03113.84
5.4.370.0080.02113.70
5.4.360.0040.02113.86
5.4.350.0050.02313.82
5.4.340.0050.01413.75
5.4.330.0030.00711.15
5.4.320.0070.01213.85
5.4.310.0050.01813.78
5.4.300.0030.03013.75
5.4.290.0070.02713.80
5.4.280.0000.03213.75
5.4.270.0040.03313.85
5.4.260.0040.03313.75
5.4.250.0050.02913.91
5.4.240.0050.03013.71
5.4.230.0050.03213.71
5.4.220.0030.03213.77
5.4.210.0030.03213.83
5.4.200.0070.01913.81
5.4.190.0130.02313.78
5.4.180.0030.01713.84
5.4.170.0040.01513.82
5.4.160.0030.03013.74
5.4.150.0040.01913.82
5.4.140.0030.03012.96
5.4.130.0070.03012.98
5.4.120.0080.02612.94
5.4.110.0060.02312.91
5.4.100.0050.02812.95
5.4.90.0040.02712.85
5.4.80.0080.01312.84
5.4.70.0020.03312.89
5.4.60.0050.02612.92
5.4.50.0050.01412.98
5.4.40.0030.02813.00
5.4.30.0060.02712.88
5.4.20.0060.01213.02
5.4.10.0070.01512.92
5.4.00.0100.02412.65
5.3.290.0030.01712.26
5.3.280.0030.02512.23
5.3.270.0040.02812.22
5.3.260.0020.02812.24
5.3.250.0030.02412.24
5.3.240.0070.02612.29
5.3.230.0040.02212.24
5.3.220.0050.02512.22
5.3.210.0070.01912.20
5.3.200.0020.02512.22
5.3.190.0020.01612.22
5.3.180.0040.02812.27
5.3.170.0070.02712.24
5.3.160.0070.02612.23
5.3.150.0070.01912.24
5.3.140.0080.02512.22
5.3.130.0050.01612.18
5.3.120.0030.01812.27
5.3.110.0020.02612.22
5.3.100.0030.03112.07
5.3.90.0060.02112.06
5.3.80.0030.02512.01
5.3.70.0030.02912.00
5.3.60.0020.01812.04
5.3.50.0030.02912.02
5.3.40.0030.03012.03
5.3.30.0090.02312.06
5.3.20.0050.01811.93
5.3.10.0010.02411.89
5.3.00.0040.02811.97
5.2.170.0050.03511.15
5.2.160.0050.03211.14
5.2.150.0020.02511.15
5.2.140.0060.02711.15
5.2.130.0030.01811.11
5.2.120.0030.03411.13
5.2.110.0020.02011.10
5.2.100.0060.02011.11
5.2.90.0050.01811.17
5.2.80.0100.02211.17
5.2.70.0030.02011.12
5.2.60.0030.01711.08
5.2.50.0010.01811.13
5.2.40.0000.01911.09
5.2.30.0030.01511.08
5.2.20.0030.01511.09
5.2.10.0020.01711.03
5.2.00.0030.02010.97
5.1.60.0000.01610.63
5.1.50.0020.01510.57
5.1.40.0020.01210.56
5.1.30.0000.01710.78
5.1.20.0020.01410.80
5.1.10.0040.01210.66
5.1.00.0030.01310.65
5.0.50.0030.0109.86
5.0.40.0030.0139.76
5.0.30.0030.0159.66
5.0.20.0000.0149.67
5.0.10.0000.0149.67
5.0.00.0000.0179.66
4.4.90.0030.0089.46
4.4.80.0060.0079.46
4.4.70.0000.0119.46
4.4.60.0030.0089.46
4.4.50.0020.0099.46
4.4.40.0000.0159.46
4.4.30.0020.0099.46
4.4.20.0000.0109.46
4.4.10.0000.0119.46
4.4.00.0020.0139.46
4.3.110.0040.0079.46
4.3.100.0050.0079.46
4.3.90.0040.0079.46
4.3.80.0000.0139.46
4.3.70.0010.0089.46
4.3.60.0000.0119.46
4.3.50.0000.0099.46
4.3.40.0020.0159.46
4.3.30.0020.0109.46
4.3.20.0020.0109.46
4.3.10.0020.0109.46
4.3.00.0000.0109.46

preferences:
47.24 ms | 400 KiB | 5 Q