3v4l.org

run code in 300+ PHP versions simultaneously
<?php function urlWhitelisted($url) { $always_allowed = array('localhost'); $whitelisted_domains = array_merge(array('somedomain.com'), $always_allowed); // partly snatched from https://gist.github.com/mjangda/1623788 // Add http if missing(to satisfy parse_url()) if (strpos($url, "/") !== 0 && strpos($url, "http") !== 0) { $url = 'http://' . $url; } $domain = parse_url($url, PHP_URL_HOST); if (strpos($url, "/") === 0 || in_array($domain, $whitelisted_domains)) { return true; } foreach ($whitelisted_domains as $whitelisted_domain) { $whitelisted_domain = '.' . $whitelisted_domain; if (strpos($domain, $whitelisted_domain) === (strlen($domain) - strlen($whitelisted_domain))) { return true; } } return false; } $domains = array('/user', 'localhost/user', 'http://localhost:4039', 'http://somedomain.com/user', 'http://google.com', 'google.com', 'somedomain.com.google.com', '()786754iusdafbiu767566&%€#'); foreach($domains as $domain) { var_dump(urlWhitelisted($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.0180.00418.27
8.3.50.0070.00921.93
8.3.40.0090.00618.71
8.3.30.0070.01419.10
8.3.20.0080.00020.40
8.3.10.0040.00423.50
8.3.00.0000.00820.87
8.2.180.0070.01418.16
8.2.170.0110.00422.96
8.2.160.0070.00720.52
8.2.150.0070.00024.18
8.2.140.0030.00624.66
8.2.130.0030.01026.16
8.2.120.0080.00019.23
8.2.110.0060.00322.29
8.2.100.0110.00017.78
8.2.90.0040.00419.22
8.2.80.0050.00317.97
8.2.70.0000.00917.50
8.2.60.0030.01317.79
8.2.50.0000.00918.07
8.2.40.0060.00318.28
8.2.30.0070.00018.30
8.2.20.0000.00817.65
8.2.10.0000.00718.12
8.2.00.0080.00017.73
8.1.280.0070.00725.92
8.1.270.0080.00023.96
8.1.260.0000.00726.35
8.1.250.0050.00228.09
8.1.240.0040.00422.02
8.1.230.0090.00319.14
8.1.220.0040.00417.74
8.1.210.0000.00818.77
8.1.200.0060.00317.35
8.1.190.0000.00817.23
8.1.180.0080.00018.10
8.1.170.0060.00318.50
8.1.160.0050.00222.05
8.1.150.0000.00718.74
8.1.140.0040.00417.40
8.1.130.0000.00719.69
8.1.120.0030.00317.51
8.1.110.0000.00817.40
8.1.100.0040.00417.42
8.1.90.0000.00717.36
8.1.80.0070.00017.46
8.1.70.0040.00417.35
8.1.60.0040.00417.58
8.1.50.0030.00517.42
8.1.40.0060.00317.55
8.1.30.0080.00017.65
8.1.20.0070.00017.66
8.1.10.0040.00417.54
8.1.00.0070.00017.33
8.0.300.0040.00418.77
8.0.290.0040.00416.63
8.0.280.0070.00018.45
8.0.270.0070.00016.82
8.0.260.0030.00317.25
8.0.250.0060.00016.94
8.0.240.0080.00017.00
8.0.230.0000.00716.98
8.0.220.0030.00316.76
8.0.210.0070.00016.78
8.0.200.0000.00616.97
8.0.190.0000.00816.84
8.0.180.0040.00416.85
8.0.170.0040.00416.93
8.0.160.0000.00716.70
8.0.150.0000.00816.82
8.0.140.0000.00716.76
8.0.130.0000.00513.30
8.0.120.0040.00416.75
8.0.110.0000.00716.94
8.0.100.0030.00416.75
8.0.90.0000.00716.76
8.0.80.0030.01716.77
8.0.70.0000.00816.67
8.0.60.0070.00016.95
8.0.50.0070.00016.79
8.0.30.0170.00417.29
8.0.20.0060.01217.40
8.0.10.0000.00717.07
8.0.00.0110.00716.69
7.4.330.0060.00015.00
7.4.320.0000.00616.61
7.4.300.0060.00016.57
7.4.290.0110.00016.52
7.4.280.0050.00216.51
7.4.270.0000.00716.41
7.4.260.0030.00316.49
7.4.250.0030.00516.46
7.4.240.0010.00616.52
7.4.230.0000.00816.39
7.4.220.0040.01416.45
7.4.210.0050.00816.38
7.4.200.0030.00316.58
7.4.160.0130.00316.22
7.4.150.0100.00717.40
7.4.140.0110.00917.86
7.4.130.0090.00816.58
7.4.120.0090.00916.47
7.4.110.0130.01016.32
7.4.100.0140.00716.59
7.4.90.0090.00816.52
7.4.80.0090.01019.39
7.4.70.0100.01016.36
7.4.60.0070.01016.38
7.4.50.0030.00316.57
7.4.40.0080.00816.42
7.4.30.0100.00816.38
7.4.00.0140.00314.63
7.3.330.0040.00413.40
7.3.320.0030.00313.35
7.3.310.0040.00416.25
7.3.300.0040.00416.41
7.3.290.0070.00716.33
7.3.280.0130.00516.34
7.3.270.0090.00917.40
7.3.260.0060.01216.36
7.3.250.0050.01316.56
7.3.240.0100.00716.61
7.3.230.0060.00916.57
7.3.210.0060.01116.30
7.3.200.0100.00619.39
7.3.190.0090.00916.49
7.3.180.0100.00616.30
7.3.170.0150.00316.45
7.3.160.0070.01016.48
7.3.120.0110.00314.79
7.2.330.0030.01516.73
7.2.320.0030.01916.46
7.2.310.0070.01116.77
7.2.300.0030.01516.59
7.2.290.0640.00816.52
7.2.00.0030.00919.29
7.1.100.0040.01118.14
7.1.70.0000.01117.11
7.1.60.0100.01319.70
7.1.50.0100.01616.95
7.1.00.0100.07022.48
7.0.200.0040.00416.52
7.0.140.0030.07321.95
7.0.60.0000.08719.95
7.0.50.0100.06317.89
7.0.40.0030.04320.40
7.0.30.0570.04320.16
7.0.20.0230.04720.09
7.0.10.0000.07720.10
7.0.00.0100.03720.20
5.6.280.0070.07020.93
5.6.210.0070.07720.65
5.6.200.0030.04018.16
5.6.190.0100.08720.63
5.6.180.3400.05020.39
5.6.170.0230.08720.57
5.6.160.0130.07020.55
5.6.150.0070.08018.12
5.6.140.0030.04718.13
5.6.130.0000.04318.19
5.6.120.0070.07721.14
5.6.110.0170.08021.14
5.6.100.0100.07721.00
5.6.90.0000.04721.04
5.6.80.0230.05720.41
5.5.350.0330.07720.38
5.5.340.0070.05018.07
5.5.330.0070.05320.37
5.5.320.0430.07320.30
5.5.310.0370.04320.26
5.5.300.0100.08017.96
5.5.290.0100.06717.97
5.5.280.0170.07020.74
5.5.270.0070.03720.79
5.5.260.0100.07020.76
5.5.250.0030.05320.61
5.5.240.4000.02720.26
5.4.450.0130.04335.74
5.4.440.0200.04734.72
5.4.430.0130.04732.20
5.4.420.0070.04332.19
5.4.410.0130.04032.19
5.4.400.0270.04032.19
5.4.390.0370.04332.19
5.4.380.0170.05318.61
5.4.370.0170.05018.61
5.4.360.0170.05018.50
5.4.350.0230.04318.76
5.4.340.0170.06018.68
5.4.320.0060.03912.51
5.4.310.0090.04512.50
5.4.300.0070.04912.51
5.4.290.0090.05212.50
5.4.280.0120.04412.40
5.4.270.0050.05112.40
5.4.260.0040.05612.39
5.4.250.0120.04912.40
5.4.240.0100.05112.40
5.4.230.0130.04912.39
5.4.220.0040.05412.39
5.4.210.0100.04612.39
5.4.200.0050.05412.39
5.4.190.0080.05012.39
5.4.180.0080.04912.39
5.4.170.0080.05112.39
5.4.160.0110.04612.39
5.4.150.0100.04812.39
5.4.140.0070.05112.07
5.4.130.0080.04612.06
5.4.120.0080.04812.02
5.4.110.0090.04712.02
5.4.100.0090.04512.01
5.4.90.0050.05412.01
5.4.80.0060.05212.01
5.4.70.0050.05012.01
5.4.60.0090.04612.01
5.4.50.0110.05012.00
5.4.40.0100.05012.00
5.4.30.0080.05011.99
5.4.20.0060.05311.99
5.4.10.0060.05211.99
5.4.00.0080.05111.48
5.3.290.0080.04012.80
5.3.280.0090.04912.71
5.3.270.0100.03912.73
5.3.260.0040.04112.72
5.3.250.0090.03612.71
5.3.240.0050.04512.72
5.3.230.0050.04112.71
5.3.220.0070.04012.68
5.3.210.0080.04512.68
5.3.200.0060.04012.68
5.3.190.0060.04212.68
5.3.180.0120.03312.67
5.3.170.0080.03612.67
5.3.160.0070.03712.68
5.3.150.0030.04312.67
5.3.140.0030.04312.66
5.3.130.0090.03712.66
5.3.120.0070.04112.66
5.3.110.0070.04412.66
5.3.100.0080.03712.12
5.3.90.0120.03412.10
5.3.80.0080.03712.09
5.3.70.0060.03912.09
5.3.60.0070.04012.08
5.3.50.0070.04112.03
5.3.40.0070.03812.02
5.3.30.0080.03611.98
5.3.20.0110.03411.77
5.3.10.0060.03611.73
5.3.00.0040.03911.71
5.2.170.0040.0339.22
5.2.160.0080.0289.22
5.2.150.0090.0289.22
5.2.140.0090.0299.21
5.2.130.0070.0299.18
5.2.120.0080.0289.18
5.2.110.0090.0289.19
5.2.100.0080.0379.18
5.2.90.0120.0359.18
5.2.80.0070.0379.17
5.2.70.0100.0389.17
5.2.60.0080.0419.13
5.2.50.0080.0369.10
5.2.40.0090.0419.07
5.2.30.0070.0419.05
5.2.20.0070.0349.04
5.2.10.0070.0278.95
5.2.00.0060.0298.80
5.1.60.0050.0248.09
5.1.50.0080.0278.09
5.1.40.0060.0348.07
5.1.30.0020.0408.42
5.1.20.0070.0298.45
5.1.10.0040.0288.18
5.1.00.0050.0268.18
5.0.50.0050.0206.65
5.0.40.0030.0206.52
5.0.30.0030.0336.32
5.0.20.0020.0226.30
5.0.10.0060.0176.28
5.0.00.0010.0346.27
4.4.90.0010.0184.78
4.4.80.0050.0144.75
4.4.70.0040.0184.76
4.4.60.0040.0214.75
4.4.50.0060.0204.77
4.4.40.0050.0264.71
4.4.30.0070.0124.76
4.4.20.0040.0164.85
4.4.10.0040.0224.85
4.4.00.0010.0284.76
4.3.110.0020.0174.66
4.3.100.0020.0194.66
4.3.90.0040.0204.64
4.3.80.0060.0294.58
4.3.70.0030.0154.63
4.3.60.0040.0144.63
4.3.50.0030.0164.63
4.3.40.0050.0304.54
4.3.30.0060.0183.32
4.3.20.0020.0203.30
4.3.10.0020.0173.26
4.3.00.0130.02032.19

preferences:
42.96 ms | 401 KiB | 5 Q