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'); 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.0090.00918.15
8.3.50.0160.00322.04
8.3.40.0160.00318.84
8.3.30.0110.00319.09
8.3.20.0000.00820.29
8.3.10.0080.00021.96
8.3.00.0060.00319.25
8.2.180.0090.00918.54
8.2.170.0100.00522.96
8.2.160.0070.00722.08
8.2.150.0090.00025.66
8.2.140.0090.00624.66
8.2.130.0040.00426.16
8.2.120.0000.00719.89
8.2.110.0050.00521.99
8.2.100.0100.00318.22
8.2.90.0000.00819.17
8.2.80.0000.00817.97
8.2.70.0000.00817.63
8.2.60.0030.00517.92
8.2.50.0030.00518.07
8.2.40.0000.00818.22
8.2.30.0000.00817.96
8.2.20.0030.00517.62
8.2.10.0060.00317.98
8.2.00.0050.00318.17
8.1.280.0190.00325.92
8.1.270.0100.01020.22
8.1.260.0070.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00322.14
8.1.230.0040.00719.15
8.1.220.0030.00517.74
8.1.210.0040.00418.77
8.1.200.0070.00317.34
8.1.190.0050.00317.23
8.1.180.0000.00818.10
8.1.170.0000.00818.53
8.1.160.0080.00021.92
8.1.150.0070.00018.80
8.1.140.0070.00017.44
8.1.130.0030.00517.73
8.1.120.0040.00717.36
8.1.110.0040.00417.49
8.1.100.0000.00717.48
8.1.90.0040.00417.36
8.1.80.0000.00717.44
8.1.70.0000.00717.48
8.1.60.0060.00317.52
8.1.50.0000.00817.37
8.1.40.0040.00417.47
8.1.30.0040.00417.63
8.1.20.0080.00017.65
8.1.10.0040.00417.52
8.1.00.0040.00417.46
8.0.300.0040.00418.77
8.0.290.0060.00316.75
8.0.280.0030.00318.39
8.0.270.0070.00016.88
8.0.260.0000.00617.19
8.0.250.0000.00716.84
8.0.240.0030.00616.84
8.0.230.0030.00316.83
8.0.220.0000.00716.78
8.0.210.0050.00216.74
8.0.200.0000.00716.89
8.0.190.0050.00316.98
8.0.180.0040.00416.96
8.0.170.0060.00316.76
8.0.160.0040.00416.70
8.0.150.0000.00716.91
8.0.140.0000.00816.89
8.0.130.0000.00613.31
8.0.120.0030.00516.74
8.0.110.0000.00916.80
8.0.100.0030.00516.89
8.0.90.0000.00717.00
8.0.80.0100.01016.84
8.0.70.0000.00716.72
8.0.60.0000.00716.73
8.0.50.0000.00816.91
8.0.30.0110.00717.00
8.0.20.0130.00917.40
8.0.10.0050.00216.89
8.0.00.0140.00516.67
7.4.330.0030.00315.04
7.4.320.0060.00016.62
7.4.300.0030.00316.55
7.4.290.0030.00316.49
7.4.280.0080.00016.50
7.4.270.0040.00416.49
7.4.260.0000.00916.55
7.4.250.0000.00716.48
7.4.240.0060.00116.56
7.4.230.0040.00416.25
7.4.220.0090.00616.42
7.4.210.0100.00816.63
7.4.200.0070.00016.57
7.4.160.0050.01116.47
7.4.150.0120.00817.40
7.4.140.0110.01117.86
7.4.130.0110.01216.56
7.4.120.0120.00616.40
7.4.110.0070.01016.48
7.4.100.0040.02016.48
7.4.90.0120.00616.45
7.4.80.0040.01419.39
7.4.70.0100.01016.53
7.4.60.0070.01016.46
7.4.50.0000.00516.66
7.4.40.0070.01016.58
7.4.30.0030.01716.49
7.4.10.0080.00814.79
7.4.00.0050.01014.92
7.3.330.0040.00213.38
7.3.320.0000.00513.37
7.3.310.0030.00316.39
7.3.300.0000.00716.40
7.3.290.0000.00716.37
7.3.280.0090.00816.36
7.3.270.0100.00717.40
7.3.260.0030.01616.43
7.3.250.0090.00816.51
7.3.240.0090.00916.34
7.3.230.0100.01316.39
7.3.210.0100.01016.44
7.3.200.0070.01119.39
7.3.190.0110.00616.74
7.3.180.0160.00016.45
7.3.170.0070.01116.59
7.3.160.0070.01316.39
7.3.130.0070.01014.70
7.3.120.0090.00914.86
7.3.110.0100.00814.96
7.3.100.0090.00414.82
7.3.90.0060.00814.80
7.3.80.0020.01214.75
7.3.70.0070.00614.93
7.3.60.0050.00714.78
7.3.50.0070.00714.61
7.3.40.0060.00514.72
7.3.30.0050.00914.88
7.3.20.0070.00716.70
7.3.10.0050.00916.82
7.3.00.0040.01016.71
7.2.330.0080.00916.68
7.2.320.0100.01616.76
7.2.310.0070.01116.53
7.2.300.0060.01116.71
7.2.290.0110.01516.69
7.2.260.0060.01315.18
7.2.250.0050.01314.98
7.2.240.0060.01215.09
7.2.230.0080.00915.17
7.2.220.0030.01015.08
7.2.210.0070.00814.95
7.2.200.0060.00814.97
7.2.190.0050.00815.08
7.2.180.0050.00914.95
7.2.170.0090.00715.01
7.2.160.0030.01314.95
7.2.150.0060.00816.95
7.2.140.0070.00716.96
7.2.130.0040.00816.71
7.2.120.0050.00916.66
7.2.110.0030.01016.93
7.2.100.0060.00716.87
7.2.90.0050.00716.84
7.2.80.0030.00916.97
7.2.70.0080.00616.91
7.2.60.0010.01316.77
7.2.50.0040.00816.87
7.2.40.0000.01417.05
7.2.30.0020.01216.98
7.2.20.0060.00817.06
7.2.10.0040.00916.79
7.2.00.0080.00817.79
7.1.330.0030.01015.80
7.1.320.0060.00715.81
7.1.310.0010.01115.55
7.1.300.0080.00715.73
7.1.290.0020.01015.56
7.1.280.0050.00815.71
7.1.270.0050.00815.68
7.1.260.0080.00615.61
7.1.250.0030.00615.71
7.1.240.0070.00515.73
7.1.230.0060.00815.60
7.1.220.0040.00715.61
7.1.210.0060.00515.71
7.1.200.0040.00915.69
7.1.190.0050.00715.70
7.1.180.0050.00715.88
7.1.170.0020.00915.71
7.1.160.0030.00915.75
7.1.150.0050.00615.67
7.1.140.0050.00415.76
7.1.130.0060.00815.72
7.1.120.0000.01215.78
7.1.110.0040.00915.72
7.1.100.0050.00716.70
7.1.90.0050.00515.78
7.1.80.0030.00915.90
7.1.70.0060.00616.21
7.1.60.0070.00816.94
7.1.50.0090.00716.04
7.1.40.0060.00615.59
7.1.30.0050.00515.79
7.1.20.0080.00415.75
7.1.10.0050.00615.75
7.1.00.0070.02917.81
7.0.330.0090.00415.31
7.0.320.0070.00715.29
7.0.310.0080.00715.41
7.0.300.0060.00515.22
7.0.290.0030.00615.30
7.0.280.0030.00815.19
7.0.270.0030.00915.38
7.0.260.0020.01215.42
7.0.250.0050.00915.38
7.0.240.0020.01115.43
7.0.230.0060.00815.56
7.0.220.0050.00715.43
7.0.210.0060.00515.27
7.0.200.0110.00915.72
7.0.190.0060.00615.27
7.0.180.0050.00815.24
7.0.170.0050.01015.29
7.0.160.0110.00315.34
7.0.150.0070.00715.41
7.0.140.0000.01315.38
7.0.130.0090.00515.49
7.0.120.0040.00915.32
7.0.110.0080.00315.23
7.0.100.0040.01115.50
7.0.90.0100.00615.45
7.0.80.0030.01015.38
7.0.70.0070.00515.30
7.0.60.0080.03316.81
7.0.50.0050.02116.29
7.0.40.0070.03015.76
7.0.30.0230.02015.68
7.0.20.0140.01615.63
7.0.10.0130.03215.71
7.0.00.0050.02015.79
5.6.400.0070.00814.42
5.6.390.0090.00514.19
5.6.380.0050.00814.35
5.6.370.0060.01114.21
5.6.360.0050.00614.25
5.6.350.0060.00814.30
5.6.340.0000.01114.18
5.6.330.0040.01014.16
5.6.320.0000.01014.20
5.6.310.0080.00314.27
5.6.300.0050.00814.30
5.6.290.0040.00914.12
5.6.280.0020.03816.53
5.6.270.0020.01214.32
5.6.260.0030.00914.35
5.6.250.0050.01014.50
5.6.240.0040.01314.18
5.6.230.0050.01014.48
5.6.220.0030.00814.33
5.6.210.0090.03116.47
5.6.200.0050.02515.56
5.6.190.0030.03516.52
5.6.180.0620.01816.46
5.6.170.0130.02116.32
5.6.160.0080.01916.46
5.6.150.0080.02415.51
5.6.140.0040.02315.59
5.6.130.0060.03515.74
5.6.120.0030.03016.48
5.6.110.0070.01716.80
5.6.100.0080.03216.42
5.6.90.0100.02916.55
5.6.80.0070.02916.19
5.6.70.0070.01916.27
5.6.60.0030.01114.19
5.6.50.0080.00514.11
5.6.40.0070.00514.24
5.6.30.0090.00614.11
5.6.20.0030.01314.19
5.6.10.0070.00914.20
5.6.00.0060.00614.26
5.5.380.0000.01014.15
5.5.370.0020.01514.27
5.5.360.0030.00814.44
5.5.350.0190.02216.34
5.5.340.0070.02115.57
5.5.330.0080.02416.25
5.5.320.0180.02816.32
5.5.310.0100.02916.42
5.5.300.0060.01815.48
5.5.290.0090.02315.43
5.5.280.0070.02916.29
5.5.270.0020.02616.40
5.5.260.0090.02816.38
5.5.250.0100.01816.29
5.5.240.0160.03016.15
5.5.230.0050.01014.02
5.5.220.0030.01213.96
5.5.210.0080.00314.23
5.5.200.0060.00914.16
5.5.190.0070.00914.20
5.5.180.0040.01214.23
5.5.170.0050.00714.07
5.5.160.0010.01214.17
5.5.150.0060.00914.16
5.5.140.0080.00714.32
5.5.130.0050.00714.28
5.5.120.0120.00214.32
5.5.110.0030.01014.07
5.5.100.0060.00813.94
5.5.90.0080.00814.25
5.5.80.0100.00514.32
5.5.70.0070.00514.25
5.5.60.0020.01014.04
5.5.50.0010.01014.24
5.5.40.0020.01414.14
5.5.30.0090.00314.21
5.5.20.0050.00814.24
5.5.10.0080.00314.06
5.5.00.0050.00813.99
5.4.450.0130.02314.11
5.4.440.0470.02114.00
5.4.430.0060.02814.05
5.4.420.0080.02213.92
5.4.410.0040.02714.01
5.4.400.0070.02013.88
5.4.390.0100.02113.93
5.4.380.0050.02413.75
5.4.370.0100.02013.97
5.4.360.0030.02913.94
5.4.350.0080.02414.05
5.4.340.0080.02313.87
5.4.330.0070.00511.27
5.4.320.0030.02713.91
5.4.310.0080.02513.97
5.4.300.0070.02613.90
5.4.290.0120.01613.74
5.4.280.0090.02113.80
5.4.270.0060.02313.87
5.4.260.0040.02413.78
5.4.250.0070.02413.84
5.4.240.0080.02113.86
5.4.230.0070.02313.91
5.4.220.0090.02113.95
5.4.210.0090.02013.79
5.4.200.0040.02413.14
5.4.190.0070.02113.71
5.4.180.0100.02013.95
5.4.170.0070.02113.79
5.4.160.0080.01913.77
5.4.150.0110.02013.88
5.4.140.0040.02412.84
5.4.130.0050.02012.88
5.4.120.0070.01912.96
5.4.110.0070.02012.97
5.4.100.0040.02212.89
5.4.90.0110.01412.97
5.4.80.0070.02012.77
5.4.70.0070.02112.83
5.4.60.0090.01812.93
5.4.50.0070.02213.00
5.4.40.0060.02212.83
5.4.30.0090.01613.03
5.4.20.0080.01912.96
5.4.10.0080.02212.76
5.4.00.0100.01712.68
5.3.290.0130.05314.82
5.3.280.0070.06014.66
5.3.270.0200.04714.66
5.3.260.0070.06014.75
5.3.250.0170.04714.59
5.3.240.0070.06014.54
5.3.230.0030.06314.61
5.3.220.0100.05314.63
5.3.210.0070.06014.50
5.3.200.0100.05014.73
5.3.190.0030.06014.63
5.3.180.0130.05014.52
5.3.170.0200.05014.48
5.3.160.0100.05714.55
5.3.150.0130.05014.48
5.3.140.0070.05314.66
5.3.130.0130.05714.62
5.3.120.0100.05714.47
5.3.110.0030.06314.58
5.3.100.0070.05714.10
5.3.90.0030.06013.88
5.3.80.0070.05714.03
5.3.70.0170.06013.99
5.3.60.0100.05714.02
5.3.50.0130.05314.12
5.3.40.0170.04714.07
5.3.30.0230.03313.83
5.3.20.0300.04313.85
5.3.10.0100.04713.59
5.3.00.0070.05313.79
5.2.170.0070.04311.11
5.2.160.0100.04011.11
5.2.150.0030.04711.29
5.2.140.0070.05011.30
5.2.130.0070.04311.03
5.2.120.0170.03311.03
5.2.110.0100.04011.07
5.2.100.0170.03311.05
5.2.90.0100.04011.06
5.2.80.0200.03010.98
5.2.70.0130.04010.96
5.2.60.0170.03711.12
5.2.50.0100.04311.02
5.2.40.0030.04711.12
5.2.30.0100.05710.84
5.2.20.0000.04710.95
5.2.10.0030.05711.03
5.2.00.0170.05010.64
5.1.60.0130.04010.07
5.1.50.0130.0339.93
5.1.40.0130.03010.01
5.1.30.0070.05310.24
5.1.20.0130.03310.39
5.1.10.0100.03010.12
5.1.00.0170.03010.09
5.0.50.0030.0408.62
5.0.40.0070.0308.51
5.0.30.0100.0408.10
5.0.20.0000.0338.27
5.0.10.0030.0308.03
5.0.00.0030.0438.32
4.4.90.0070.0205.93
4.4.80.0000.0275.77
4.4.70.0170.0105.78
4.4.60.0000.0275.90
4.4.50.0070.0235.76
4.4.40.0100.0405.86
4.4.30.0030.0235.90
4.4.20.0070.0235.96
4.4.10.0070.0235.86
4.4.00.0030.0375.92
4.3.110.0030.0235.86
4.3.100.0070.0205.73
4.3.90.0030.0235.86
4.3.80.0030.0375.70
4.3.70.0100.0135.85
4.3.60.0100.0175.70
4.3.50.0070.0205.82
4.3.40.0030.0375.82
4.3.30.0030.0234.79
4.3.20.0030.0234.79
4.3.10.0100.0174.79
4.3.00.0000.0277.27

preferences:
38.37 ms | 401 KiB | 5 Q