3v4l.org

run code in 300+ PHP versions simultaneously
<?php function is_valid_time_domain( $url ) { $whitelisted_domains = array( 'mydomain.com', 'mydomain.net' ); $domain = parse_url( $url, PHP_URL_HOST ); // Check if we match the domain exactly if ( in_array( $domain, $whitelisted_domains ) ) { return true; } foreach( $whitelisted_domains as $whitelisted_domain ) { $whitelisted_domain = '.' . $whitelisted_domain; // Prevent things like 'evilsitetime.com' if( strpos( $domain, $whitelisted_domain ) === ( strlen( $domain ) - strlen( $whitelisted_domain ) ) ) { return true; break; } } return false; } $domains = array( 'http://mydomain.com', 'http://www.mydomain.com', 'http://mydomain.com.evilsite.com', 'http://mydomain.com.mydomain.net', 'http://evilsitemydomain.com', 'http://mydomain.com.evil%45site.com', 'http://evil%45sitemydomain.com', 'http://evil%00sitemydomain.com', 'http://mydomain.com.evil%00site.com','http://evilsite.com/.mydomain.com', 'http://mydomain.com%00.evilsite.com', 'http://evilsite.com#.mydomain.com', 'http://evilsite.com@mydomain.com', 'http://mydomain.com@evilsite.com', 'http://evilsite.com@#mydomain.com', 'http://evilsite.com:mydomain.com', 'file://stuff@myfile:mydomain.com', 'file:///dev@mydomain.com', 'file:///dev?@mydomain.com', 'file:///dev?mydomain.com', 'http:mydomain.com', 'http:evilsite.com//mydomain.com', 'http:mydomain.com//evilsite.com', 'http:mydomain.com', 'http://[2010:836B:4179::836B:4179].mydomain.com', 'http://evilsite.com+mydomain.com', 'http://mydomain.com+evilsite.com', 'http://%6Dydomain.com', 'http://evilsite$mydomain.com', 'http://evilsite;mydomain.com', 'http://%1B.mydomain.com/', 'http://%1Bmydomain.com/', 'http://mydom ain.com', 'http://my domain.com', 'http://mydomain.com.eu', 'http://"mydomain.com', 'http://".mydomain.com', 'http://%22.mydomain.com', 'http://£.mydomain.com'); foreach( $domains as $domain ) { echo $domain . "\n"; var_dump( is_valid_time_domain( $domain ) ); }

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.01518.43
8.3.50.0260.00921.97
8.3.40.0090.00618.97
8.3.30.0040.01119.05
8.3.20.0050.00320.33
8.3.10.0030.00521.76
8.3.00.0040.00419.13
8.2.180.0120.00316.48
8.2.170.0100.00322.96
8.2.160.0040.01422.26
8.2.150.0000.00825.66
8.2.140.0030.00624.66
8.2.130.0050.00326.16
8.2.120.0060.00317.75
8.2.110.0070.00321.04
8.2.100.0090.00317.72
8.2.90.0030.00617.75
8.2.80.0040.00419.30
8.2.70.0000.00818.00
8.2.60.0090.00018.22
8.2.50.0030.00618.10
8.2.40.0030.00519.42
8.2.30.0000.00719.29
8.2.20.0050.00317.62
8.2.10.0000.00818.11
8.2.00.0050.00218.14
8.1.280.0120.00625.92
8.1.270.0030.00620.33
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0070.00420.69
8.1.230.0080.00420.90
8.1.220.0030.00517.79
8.1.210.0050.00318.77
8.1.200.0090.00017.23
8.1.190.0000.00817.22
8.1.180.0080.00018.10
8.1.170.0000.00820.41
8.1.160.0000.00820.58
8.1.150.0000.00819.01
8.1.140.0000.00817.55
8.1.130.0070.00017.61
8.1.120.0070.00317.49
8.1.110.0040.00417.35
8.1.100.0070.00017.45
8.1.90.0040.00417.45
8.1.80.0000.00717.47
8.1.70.0040.00417.46
8.1.60.0000.01017.48
8.1.50.0040.00417.39
8.1.40.0030.00617.52
8.1.30.0000.00817.62
8.1.20.0000.00817.59
8.1.10.0060.00317.44
8.1.00.0040.00417.37
8.0.300.0040.00419.90
8.0.290.0070.00016.75
8.0.280.0000.00718.44
8.0.270.0000.00717.23
8.0.260.0000.00617.24
8.0.250.0000.00716.96
8.0.240.0050.00216.84
8.0.230.0000.00816.83
8.0.220.0070.00016.78
8.0.210.0050.00316.92
8.0.200.0030.00516.84
8.0.190.0000.00716.98
8.0.180.0000.00716.93
8.0.170.0040.00416.95
8.0.160.0040.00416.69
8.0.150.0040.00416.77
8.0.140.0000.00716.90
8.0.130.0000.00613.30
8.0.120.0080.00016.73
8.0.110.0040.00416.92
8.0.100.0000.00716.77
8.0.90.0040.00416.71
8.0.80.0130.01016.83
8.0.70.0060.00316.77
8.0.60.0000.00816.85
8.0.50.0080.00016.79
8.0.30.0090.01116.95
8.0.20.0080.01117.40
8.0.10.0040.00416.83
8.0.00.0110.00916.67
7.4.330.0020.00215.05
7.4.320.0030.00316.40
7.4.300.0030.00316.62
7.4.290.0040.00416.47
7.4.280.0050.00316.49
7.4.270.0000.00716.48
7.4.260.0050.00516.53
7.4.250.0070.00416.46
7.4.240.0040.00316.60
7.4.230.0040.00416.48
7.4.220.0050.01116.34
7.4.210.0100.00816.58
7.4.200.0000.00816.42
7.4.160.0150.00416.61
7.4.150.0150.00317.40
7.4.140.0080.01117.86
7.4.130.0100.01116.62
7.4.120.0120.00516.44
7.4.110.0080.01116.48
7.4.100.0130.00416.64
7.4.90.0030.01716.73
7.4.80.0180.00619.39
7.4.70.0070.01016.32
7.4.60.0080.00816.47
7.4.50.0000.00916.37
7.4.40.0080.00816.65
7.4.30.0100.01016.50
7.4.10.0070.01015.01
7.4.00.0070.00814.61
7.3.330.0070.00013.23
7.3.320.0000.00613.36
7.3.310.0030.00316.25
7.3.300.0040.00416.36
7.3.290.0040.00416.36
7.3.280.0140.00516.41
7.3.270.0060.01217.40
7.3.260.0090.00916.39
7.3.250.0100.01016.45
7.3.240.0140.00416.38
7.3.230.0100.00616.39
7.3.210.0100.01416.55
7.3.200.0080.01119.39
7.3.190.0110.00716.40
7.3.180.0100.00716.60
7.3.170.0140.00916.29
7.3.160.0060.01216.55
7.3.130.0040.01114.92
7.3.120.0070.01115.02
7.3.110.0110.00714.92
7.3.100.0060.00914.81
7.3.90.0070.01314.92
7.3.80.0000.00914.99
7.3.70.0090.00614.83
7.3.60.0090.00614.68
7.3.50.0040.01115.01
7.3.40.0030.00714.94
7.3.30.0030.01315.07
7.3.20.0160.00016.61
7.3.10.0090.00716.59
7.3.00.0080.00716.59
7.2.330.0060.01316.74
7.2.320.0070.01316.56
7.2.310.0090.00916.66
7.2.300.0140.00716.56
7.2.290.0120.00616.83
7.2.260.0090.00914.90
7.2.250.0130.00715.24
7.2.240.0000.01515.27
7.2.230.0070.01014.95
7.2.220.0120.00615.20
7.2.210.0000.01214.89
7.2.200.0060.00615.06
7.2.190.0030.01015.02
7.2.180.0110.00715.06
7.2.170.0080.00414.96
7.2.160.0090.00614.99
7.2.150.0090.00616.93
7.2.140.0070.01016.79
7.2.130.0100.00416.92
7.2.120.0080.01116.78
7.2.110.0130.00716.92
7.2.100.0170.01216.70
7.2.90.0110.01016.90
7.2.80.0030.01916.94
7.2.70.0020.01516.82
7.2.60.0110.00916.75
7.2.50.0110.00616.64
7.2.40.0070.01316.69
7.2.30.0120.00516.90
7.2.20.0100.00816.76
7.2.10.0140.00316.77
7.2.00.0110.00917.75
7.1.330.0140.00015.76
7.1.320.0060.01315.81
7.1.310.0030.01015.79
7.1.300.0060.00315.87
7.1.290.0030.00715.82
7.1.280.0070.01015.97
7.1.270.0040.01215.84
7.1.260.0030.00715.48
7.1.250.0150.00615.82
7.1.240.0070.01115.77
7.1.230.0000.01416.02
7.1.220.0090.00615.75
7.1.210.0050.00515.90
7.1.200.0040.00715.92
7.1.190.0000.01115.78
7.1.180.0080.00815.82
7.1.170.0030.00915.93
7.1.160.0000.01315.79
7.1.150.0080.00615.52
7.1.140.0070.01015.75
7.1.130.0040.00815.79
7.1.120.0070.00415.59
7.1.110.0000.01415.79
7.1.100.0040.00817.05
7.1.90.0130.00315.79
7.1.80.0070.00715.60
7.1.70.0050.00516.34
7.1.60.0080.01117.68
7.1.50.0080.01316.34
7.1.40.0030.00615.84
7.1.30.0040.00715.52
7.1.20.0090.00615.70
7.1.10.0030.01215.76
7.1.00.0050.04219.00
7.0.330.0060.00615.46
7.0.320.0030.01015.43
7.0.310.0060.00615.19
7.0.300.0080.00415.42
7.0.290.0080.00315.43
7.0.280.0090.00615.13
7.0.270.0070.00715.55
7.0.260.0100.00315.20
7.0.250.0110.00015.35
7.0.240.0040.01115.53
7.0.230.0090.00015.53
7.0.220.0040.00815.59
7.0.210.0040.00415.58
7.0.200.0120.00715.93
7.0.190.0040.01415.30
7.0.180.0000.01615.39
7.0.170.0080.00415.14
7.0.160.0060.00915.10
7.0.150.0090.00615.53
7.0.140.0090.00915.44
7.0.130.0040.00815.28
7.0.120.0090.00315.29
7.0.110.0100.00715.52
7.0.100.0030.01015.49
7.0.90.0000.01015.04
7.0.80.0090.00315.37
7.0.70.0070.00715.18
7.0.60.0070.04617.58
7.0.50.0030.03016.65
7.0.40.0050.03216.92
7.0.30.0220.03016.90
7.0.20.0120.04016.83
7.0.10.0120.04416.63
7.0.00.0100.02316.78
5.6.400.0030.00614.41
5.6.390.0000.01114.23
5.6.380.0030.01214.38
5.6.370.0070.00714.54
5.6.360.0030.01014.57
5.6.350.0060.00614.54
5.6.340.0070.00314.35
5.6.330.0100.00314.13
5.6.320.0070.01014.40
5.6.310.0000.01114.21
5.6.300.0090.00614.68
5.6.290.0120.00614.12
5.6.280.0060.03917.66
5.6.270.0070.00714.36
5.6.260.0070.01014.25
5.6.250.0090.00614.39
5.6.240.0080.00314.44
5.6.230.0000.01114.30
5.6.220.0030.00614.22
5.6.210.0030.03817.39
5.6.200.0020.04216.28
5.6.190.0050.03617.52
5.6.180.1750.02617.41
5.6.170.0120.02317.52
5.6.160.0070.02917.30
5.6.150.0070.03916.21
5.6.140.0090.04116.08
5.6.130.0110.04016.17
5.6.120.0020.02617.62
5.6.110.0030.02517.58
5.6.100.0070.04317.76
5.6.90.0080.04317.62
5.6.80.0040.03917.18
5.6.70.0120.02317.38
5.6.60.0030.01414.34
5.6.50.0040.01214.32
5.6.40.0090.00614.36
5.6.30.0030.01214.43
5.6.20.0060.00614.36
5.6.10.0090.00614.20
5.6.00.0000.00914.31
5.5.380.0040.01114.48
5.5.370.0060.01014.43
5.5.360.0060.00314.14
5.5.350.0230.03717.27
5.5.340.0090.03216.01
5.5.330.0030.02517.20
5.5.320.0250.02617.12
5.5.310.0190.04017.23
5.5.300.0040.02516.15
5.5.290.0090.03016.14
5.5.280.0070.04517.54
5.5.270.0030.02717.53
5.5.260.0100.04217.56
5.5.250.0080.03317.44
5.5.240.0180.03917.29
5.5.230.0030.00914.17
5.5.220.0090.00614.03
5.5.210.0030.01314.39
5.5.200.0080.00814.29
5.5.190.0060.00914.21
5.5.180.0030.01213.87
5.5.170.0060.00613.80
5.5.160.0060.00914.37
5.5.150.0080.00414.28
5.5.140.0090.00314.41
5.5.130.0060.00314.24
5.5.120.0060.00614.38
5.5.110.0060.00614.32
5.5.100.0070.01014.08
5.5.90.0070.00414.09
5.5.80.0040.01114.46
5.5.70.0070.00714.21
5.5.60.0040.00814.32
5.5.50.0030.01214.27
5.5.40.0130.00014.18
5.5.30.0040.00814.16
5.5.20.0030.01014.39
5.5.10.0070.01014.24
5.5.00.0090.00614.37
5.4.450.0290.03315.55
5.4.440.0470.03215.52
5.4.430.0100.03015.59
5.4.420.0100.03015.56
5.4.410.0080.03015.59
5.4.400.0080.03015.48
5.4.390.0060.03415.41
5.4.380.0130.02515.27
5.4.370.0160.02315.49
5.4.360.0130.02715.40
5.4.350.0050.03315.40
5.4.340.0050.03515.49
5.4.330.0030.01011.66
5.4.320.0150.03315.43
5.4.310.0170.02015.38
5.4.300.0070.03215.43
5.4.290.0050.03215.44
5.4.280.0140.02515.39
5.4.270.0080.02915.44
5.4.260.0070.03015.48
5.4.250.0160.02715.37
5.4.240.0100.02815.26
5.4.230.0080.03015.49
5.4.220.0120.02515.49
5.4.210.0090.03315.40
5.4.200.0080.02814.29
5.4.190.0110.02815.41
5.4.180.0080.02915.28
5.4.170.0030.03615.42
5.4.160.0100.02815.44
5.4.150.0070.03215.39
5.4.140.0030.03313.96
5.4.130.0080.02714.06
5.4.120.0100.02513.96
5.4.110.0150.02814.12
5.4.100.0080.02813.96
5.4.90.0130.02713.96
5.4.80.0100.02814.13
5.4.70.0100.02614.13
5.4.60.0120.02714.13
5.4.50.0090.02514.10
5.4.40.0120.02514.13
5.4.30.0090.03614.02
5.4.20.0140.03013.97
5.4.10.0120.02314.09
5.4.00.0080.02613.77
5.3.290.0070.06014.68
5.3.280.0200.04314.51
5.3.270.0170.05014.64
5.3.260.0170.05014.62
5.3.250.0000.06314.62
5.3.240.0130.05014.73
5.3.230.0100.05014.61
5.3.220.0170.04314.49
5.3.210.0100.05714.44
5.3.200.0100.05314.65
5.3.190.0130.05014.53
5.3.180.0370.03014.69
5.3.170.0130.05014.63
5.3.160.0130.05014.59
5.3.150.0130.05014.46
5.3.140.0100.05014.46
5.3.130.0230.06314.49
5.3.120.0070.07014.54
5.3.110.0030.06314.67
5.3.100.0170.05314.05
5.3.90.0200.04014.08
5.3.80.0070.05714.04
5.3.70.0100.05313.94
5.3.60.0100.05014.17
5.3.50.0130.04714.07
5.3.40.0170.04313.95
5.3.30.0100.04714.07
5.3.20.0100.05013.85
5.3.10.0130.04313.82
5.3.00.0070.05313.78
5.2.170.0070.04711.30
5.2.160.0030.04711.13
5.2.150.0070.04311.11
5.2.140.0100.04311.27
5.2.130.0200.03010.97
5.2.120.0000.05011.19
5.2.110.0030.04711.10
5.2.100.0070.04011.26
5.2.90.0070.04711.18
5.2.80.0070.04311.25
5.2.70.0130.04011.07
5.2.60.0070.04310.99
5.2.50.0070.04311.10
5.2.40.0100.03710.99
5.2.30.0070.04310.96
5.2.20.0100.04011.03
5.2.10.0000.04711.02
5.2.00.0100.03710.70
5.1.60.0000.0409.93
5.1.50.0070.0379.86
5.1.40.0130.03010.04
5.1.30.0100.03310.20
5.1.20.0130.03310.26
5.1.10.0070.03710.08
5.1.00.0130.03010.02
5.0.50.0130.0238.56
5.0.40.0170.0178.60
5.0.30.0070.0438.39
5.0.20.0030.0308.29
5.0.10.0030.0308.27
5.0.00.0070.0408.28
4.4.90.0070.0205.88
4.4.80.0030.0235.92
4.4.70.0100.0205.84
4.4.60.0030.0235.89
4.4.50.0000.0275.89
4.4.40.0030.0375.86
4.4.30.0000.0305.93
4.4.20.0030.0305.82
4.4.10.0030.0305.94
4.4.00.0100.0405.83
4.3.110.0030.0205.69
4.3.100.0070.0205.82
4.3.90.0030.0205.66
4.3.80.0070.0305.70
4.3.70.0100.0175.78
4.3.60.0070.0205.66
4.3.50.0030.0235.66
4.3.40.0130.0335.73
4.3.30.0000.0234.82
4.3.20.0000.0234.82
4.3.10.0030.0234.88
4.3.00.0130.0177.27

preferences:
64.98 ms | 401 KiB | 5 Q