3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { if (preg_match('/(?:\/(?:home|default|index)\..{3,4}\*)/i',$url)) { $url = preg_replace('/^(.*)(\/(?:home|default|index)\..{3,4}\*)(.*)$/i', "$1$2$3", $url); } else { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\?\/#]+.*)?$/i', "$1$2", $url); } return $url; } echo remove_index_etc("http://a.com/index.html") . PHP_EOL; echo remove_index_etc("http://a.com/index.html*"). PHP_EOL; echo remove_index_etc("http://a.com/*index.html*"). PHP_EOL; echo remove_index_etc("http://a.com/*index.html*?a=1"). PHP_EOL; echo remove_index_etc("http://a.com/*index.html*?a=1"). PHP_EOL; echo remove_index_etc("http://a.com/*index.html*a=1*"). PHP_EOL; echo remove_index_etc("http://a.com/index.html/*"). PHP_EOL; echo remove_index_etc("http://a.com/index.html?a=1"). PHP_EOL; echo remove_index_etc("http://a.com/index.html?a=1*"). PHP_EOL; echo remove_index_etc("http://a.com/index.html*a=1"). PHP_EOL; echo remove_index_etc("http://a.com/*"). PHP_EOL; echo remove_index_etc("http://a.com"). PHP_EOL; echo remove_index_etc("http://a.com/index.html/?a=1*"). PHP_EOL; echo remove_index_etc("http://a.com/index.html#a=1*"). PHP_EOL; echo remove_index_etc("http://a.com#index.html?a=1"). PHP_EOL; echo remove_index_etc("http://a.com#index.html?a=1*"). PHP_EOL;

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.0100.01416.75
8.3.50.0180.00217.47
8.3.40.0110.00418.89
8.3.30.0130.00918.77
8.3.20.0050.00318.76
8.3.10.0030.00520.61
8.3.00.0060.00319.50
8.2.180.0190.00316.50
8.2.170.0120.00822.96
8.2.160.0140.00320.50
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0070.00321.00
8.2.110.0030.00721.00
8.2.100.0060.00618.03
8.2.90.0070.00320.90
8.2.80.0000.00818.04
8.2.70.0040.00418.00
8.2.60.0030.00618.05
8.2.50.0000.00818.07
8.2.40.0030.00618.34
8.2.30.0040.00418.00
8.2.20.0050.00217.86
8.2.10.0080.00017.69
8.2.00.0000.00817.83
8.1.280.0070.01125.92
8.1.270.0070.00024.66
8.1.260.0080.00026.35
8.1.250.0040.00728.09
8.1.240.0070.00322.54
8.1.230.0120.00021.03
8.1.220.0000.00817.74
8.1.210.0090.00018.89
8.1.200.0070.00317.60
8.1.190.0000.00817.65
8.1.180.0050.00318.10
8.1.170.0040.00418.84
8.1.160.0000.00818.88
8.1.150.0000.00818.90
8.1.140.0030.00617.57
8.1.130.0040.00417.95
8.1.120.0040.00417.57
8.1.110.0080.00017.54
8.1.100.0080.00017.63
8.1.90.0050.00217.62
8.1.80.0040.00417.73
8.1.70.0080.00017.67
8.1.60.0060.00317.79
8.1.50.0060.00317.53
8.1.40.0090.00017.76
8.1.30.0040.00417.79
8.1.20.0000.00917.86
8.1.10.0040.00417.74
8.1.00.0040.00417.66
8.0.300.0060.00320.18
8.0.290.0040.00416.75
8.0.280.0030.00318.52
8.0.270.0030.00317.25
8.0.260.0000.00816.94
8.0.250.0040.00417.18
8.0.240.0000.00717.18
8.0.230.0000.00717.06
8.0.220.0000.00717.08
8.0.210.0000.01117.11
8.0.200.0030.00317.12
8.0.190.0040.00417.12
8.0.180.0040.00417.10
8.0.170.0040.00416.98
8.0.160.0030.00417.00
8.0.150.0040.00417.02
8.0.140.0000.01017.09
8.0.130.0000.00513.57
8.0.120.0050.00316.94
8.0.110.0040.00416.96
8.0.100.0070.00017.13
8.0.90.0070.00016.93
8.0.80.0120.00617.07
8.0.70.0040.00416.92
8.0.60.0040.00417.02
8.0.50.0040.00417.03
8.0.30.0090.01417.55
8.0.20.0090.00917.66
8.0.10.0000.00717.15
8.0.00.0140.01216.94
7.4.330.0050.00013.13
7.4.320.0000.00716.74
7.4.300.0060.00016.88
7.4.290.0030.00516.88
7.4.280.0070.00316.70
7.4.270.0000.00716.89
7.4.260.0000.00513.55
7.4.250.0030.00616.90
7.4.240.0000.00716.84
7.4.230.0030.00316.53
7.4.220.0030.01616.67
7.4.210.0070.00916.88
7.4.200.0050.00216.61
7.4.190.0040.00416.82
7.4.160.0130.00316.80
7.4.150.0190.00016.75
7.4.140.0080.01316.75
7.4.130.0050.01516.76
7.4.120.0060.01116.78
7.4.110.0110.00716.83
7.4.100.0070.01016.79
7.4.90.0060.01216.91
7.4.80.0100.01019.39
7.4.70.0030.02116.77
7.4.60.0090.00916.67
7.4.50.0030.01016.48
7.4.40.0040.01116.45
7.4.30.0100.00716.78
7.4.10.0040.01115.20
7.4.00.0070.00915.22
7.3.330.0060.00013.35
7.3.320.0000.00513.42
7.3.310.0000.00716.48
7.3.300.0070.00016.43
7.3.290.0040.01116.45
7.3.280.0110.00916.42
7.3.270.0030.01416.52
7.3.260.0200.00416.56
7.3.250.0090.00916.61
7.3.240.0060.01016.70
7.3.230.0060.01216.51
7.3.210.0100.01016.84
7.3.200.0030.01616.85
7.3.190.0150.00616.59
7.3.180.0030.01316.72
7.3.170.0080.00816.73
7.3.160.0140.00316.78
7.3.130.0110.00715.34
7.3.120.0070.00914.90
7.3.110.0050.01114.97
7.3.100.0050.01015.16
7.3.90.0040.00614.98
7.3.80.0090.00615.15
7.3.70.0050.01014.92
7.3.60.0020.01314.90
7.3.50.0060.00814.95
7.3.40.0060.00714.96
7.3.30.0000.01214.88
7.3.20.0080.00616.71
7.3.10.0100.00816.71
7.3.00.0110.00616.79
7.2.330.0060.01316.74
7.2.320.0140.01116.83
7.2.310.0140.01116.91
7.2.300.0040.01416.63
7.2.290.0120.00416.67
7.2.260.0090.00615.43
7.2.250.0070.01215.04
7.2.240.0080.01015.18
7.2.230.0070.01015.19
7.2.220.0070.00915.31
7.2.210.0030.01315.24
7.2.200.0040.01315.23
7.2.190.0100.00715.32
7.2.180.0110.00915.38
7.2.170.0060.00615.13
7.2.160.0040.00815.30
7.2.150.0000.01116.88
7.2.140.0100.01016.99
7.2.130.0030.01017.21
7.2.120.0140.00316.74
7.2.110.0120.00316.80
7.2.100.0000.01117.08
7.2.90.0060.00817.20
7.2.80.0110.00416.98
7.2.70.0000.01617.10
7.2.60.0040.01517.08
7.2.50.0040.00716.79
7.2.40.0070.00717.03
7.2.30.0070.00717.03
7.2.20.0030.01317.04
7.2.10.0080.00716.86
7.2.00.0070.00818.48
7.1.330.0090.00615.99
7.1.320.0050.00715.98
7.1.310.0000.01415.78
7.1.300.0080.00815.88
7.1.290.0100.00815.83
7.1.280.0080.00515.88
7.1.270.0050.00915.89
7.1.260.0070.00715.91
7.1.250.0030.01015.81
7.1.240.0080.00316.00
7.1.230.0060.00316.04
7.1.220.0060.00915.97
7.1.210.0060.00915.91
7.1.200.0080.00816.08
7.1.190.0050.00515.84
7.1.180.0030.01016.05
7.1.170.0070.00715.67
7.1.160.0100.00315.91
7.1.150.0030.00615.89
7.1.140.0000.01015.88
7.1.130.0080.00815.94
7.1.120.0070.00416.05
7.1.110.0070.01015.98
7.1.100.0020.01417.13
7.1.90.0060.00615.64
7.1.80.0030.00615.91
7.1.70.0030.00716.57
7.1.60.0070.01017.67
7.1.50.0070.01216.42
7.1.40.0030.01016.02
7.1.30.0070.00715.93
7.1.20.0030.00715.87
7.1.10.0000.01215.86
7.1.00.0030.02619.24
7.0.330.0030.00915.39
7.0.320.0040.01115.34
7.0.310.0030.00915.53
7.0.300.0030.01215.61
7.0.290.0030.01015.60
7.0.280.0070.00715.72
7.0.270.0000.01315.35
7.0.260.0110.00315.61
7.0.250.0040.00815.59
7.0.240.0000.01715.70
7.0.230.0030.00615.65
7.0.220.0030.01215.60
7.0.210.0070.00715.43
7.0.200.0460.00315.25
7.0.190.0090.00315.43
7.0.180.0070.00715.63
7.0.170.0080.00415.58
7.0.160.0080.00415.34
7.0.150.0080.00415.64
7.0.140.0040.04418.64
7.0.130.0060.00915.37
7.0.120.0030.03518.79
7.0.110.0060.00615.68
7.0.100.0030.01015.70
7.0.90.0060.00315.47
7.0.80.0040.00415.44
7.0.70.0070.00415.64
7.0.60.0100.02317.68
7.0.50.0050.02816.85
7.0.40.0080.04516.94
7.0.30.0030.03816.81
7.0.20.0100.03016.99
7.0.10.0050.05117.09
7.0.00.0050.04816.87
5.6.400.0090.00914.56
5.6.390.0000.01214.33
5.6.380.0120.00414.18
5.6.370.0070.01014.56
5.6.360.0000.01514.53
5.6.350.0030.00514.60
5.6.340.0000.01314.50
5.6.330.0000.01414.32
5.6.320.0090.00614.33
5.6.310.0070.00714.64
5.6.300.0030.01014.51
5.6.290.0000.01414.49
5.6.280.0030.04417.73
5.6.270.0060.00614.39
5.6.260.0070.00414.33
5.6.250.0070.01014.45
5.6.240.0100.00314.67
5.6.230.0070.01014.40
5.6.220.0090.00614.71
5.6.210.0130.03817.42
5.6.200.0030.03016.25
5.6.190.0070.04017.50
5.6.180.0070.02917.52
5.6.170.0080.04117.45
5.6.160.0030.02817.51
5.6.150.0080.04717.49
5.6.140.0080.04517.41
5.6.130.0070.04817.25
5.6.120.0030.02817.30
5.6.110.0110.04417.41
5.6.100.0080.04017.37
5.6.90.0070.02217.41
5.6.80.0050.02516.94
5.6.70.0100.04117.08
5.6.60.0030.02817.18
5.6.50.0070.04517.14
5.6.40.0070.04416.94
5.6.30.0020.03616.95
5.6.20.0090.04017.05
5.6.10.0020.03116.96
5.6.00.0080.02617.18
5.5.380.0040.00714.55
5.5.370.0120.00414.20
5.5.360.0030.00614.09
5.5.350.0200.04017.25
5.5.340.0080.04016.17
5.5.330.0050.04817.41
5.5.320.0070.04917.32
5.5.310.0000.04517.22
5.5.300.0050.04817.32
5.5.290.0090.04617.42
5.5.280.0030.03717.20
5.5.270.0030.03117.28
5.5.260.0050.03417.04
5.5.250.0030.02917.06
5.5.240.0070.04216.89
5.5.230.0050.02616.98
5.5.220.0100.02117.04
5.5.210.0110.02416.72
5.5.200.0060.02617.03
5.5.190.0080.02716.64
5.5.180.0120.03516.66
5.5.170.0000.01614.07
5.5.160.0080.02316.99
5.5.150.0080.02817.02
5.5.140.0080.04316.72
5.5.130.0100.04116.60
5.5.120.0050.04616.72
5.5.110.0030.03216.82
5.5.100.0050.04016.78
5.5.90.0080.03916.78
5.5.80.0000.04416.99
5.5.70.0080.04016.60
5.5.60.0120.02316.87
5.5.50.0140.02016.62
5.5.40.0070.02216.70
5.5.30.0060.04316.86
5.5.20.0020.03016.65
5.5.10.0030.03816.93
5.5.00.0100.02216.90
5.4.450.0050.04216.11
5.4.440.0070.04216.18
5.4.430.0070.04216.23
5.4.420.0020.04616.13
5.4.410.0020.03816.10
5.4.400.0100.01816.06
5.4.390.0010.03115.94
5.4.380.0030.02316.09
5.4.370.0050.03916.14
5.4.360.0070.02516.11
5.4.350.0040.04116.08
5.4.340.0060.02615.95
5.4.330.0080.00813.02
5.4.320.0050.03515.93
5.4.310.0120.03516.13
5.4.300.0070.02415.94
5.4.290.0100.01815.94
5.4.280.0070.03816.13
5.4.270.0050.03215.94
5.4.260.0030.02716.01
5.4.250.0060.03816.13
5.4.240.0030.04316.11
5.4.230.0130.01916.09
5.4.220.0030.03416.08
5.4.210.0070.04315.94
5.4.200.0090.03815.93
5.4.190.0040.03215.93
5.4.180.0040.02715.93
5.4.170.0030.02515.93
5.4.160.0050.02116.12
5.4.150.0030.02315.93
5.4.140.0070.02214.81
5.4.130.0060.02714.73
5.4.120.0080.03714.68
5.4.110.0050.03414.73
5.4.100.0100.03714.75
5.4.90.0050.04214.73
5.4.80.0050.03714.68
5.4.70.0050.03714.67
5.4.60.0050.03714.67
5.4.50.0200.01314.64
5.4.40.0060.03914.84
5.4.30.0060.02314.67
5.4.20.0000.04114.64
5.4.10.0050.02714.69
5.4.00.0080.01814.44
5.3.290.0090.04013.89
5.3.280.0050.02513.85
5.3.270.0040.02313.84
5.3.260.0070.03713.83
5.3.250.0030.02813.82
5.3.240.0060.03313.82
5.3.230.0000.04613.89
5.3.220.0030.03313.76
5.3.210.0080.02213.82
5.3.200.0050.04113.83
5.3.190.0000.03013.83
5.3.180.0070.03813.83
5.3.170.0040.03913.83
5.3.160.0090.03813.80
5.3.150.0080.02013.76
5.3.140.0030.03013.83
5.3.130.0100.03513.80
5.3.120.0080.03813.81
5.3.110.0080.03013.81
5.3.100.0040.04013.58
5.3.90.0020.02513.56
5.3.80.0060.03013.51
5.3.70.0050.02213.55
5.3.60.0080.01713.52
5.3.50.0070.01713.45
5.3.40.0040.03813.52
5.3.30.0090.03913.45
5.3.20.0070.03813.44
5.3.10.0050.02213.34
5.3.00.0070.02813.30
5.2.170.0100.06311.22
5.2.160.0070.06311.18
5.2.150.0100.06011.16
5.2.140.0130.05711.20
5.2.130.0100.05711.16
5.2.120.0030.04711.19
5.2.110.0030.06011.07
5.2.100.0070.03311.01
5.2.90.0100.05011.17
5.2.80.0030.06311.27
5.2.70.0130.05311.03
5.2.60.0070.05011.06
5.2.50.0070.06011.06
5.2.40.0070.04311.02
5.2.30.0070.05710.95
5.2.20.0100.05710.98
5.2.10.0000.03010.93
5.2.00.0030.06710.65
5.1.60.0000.03010.06
5.1.50.0070.05010.03
5.1.40.0030.05310.14
5.1.30.0070.03010.34
5.1.20.0030.05710.32
5.1.10.0070.04310.08
5.1.00.0000.03310.05
5.0.50.0000.0478.61
5.0.40.0100.0138.38
5.0.30.0000.0638.21
5.0.20.0030.0478.18
5.0.10.0070.0408.27
5.0.00.0030.0508.09
4.4.90.0000.0376.66
4.4.80.0000.0336.66
4.4.70.0070.0136.66
4.4.60.0030.0136.66
4.4.50.0000.0176.66
4.4.40.0030.0276.66
4.4.30.0000.0376.66
4.4.20.0000.0406.66
4.4.10.0070.0336.66
4.4.00.0000.0336.66
4.3.110.0030.0376.66
4.3.100.0030.0376.66
4.3.90.0000.0406.66
4.3.80.0000.0536.66
4.3.70.0000.0336.66
4.3.60.0000.0176.66
4.3.50.0030.0206.66
4.3.40.0000.0236.66
4.3.30.0000.0176.66
4.3.20.0000.0376.66
4.3.10.0000.0376.66
4.3.00.0030.0276.66

preferences:
105.68 ms | 401 KiB | 5 Q