3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { if (preg_match('/(?:\/(?:home|default|index)\..{3,4}\*)',$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.0140.00318.55
8.3.50.0150.00822.13
8.3.40.0060.00918.79
8.3.30.0110.00319.00
8.3.20.0030.00620.16
8.3.10.0040.00423.73
8.3.00.0080.00022.44
8.2.180.0150.00417.00
8.2.170.0140.00022.96
8.2.160.0090.00620.32
8.2.150.0130.00624.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0070.00022.38
8.2.110.0000.00922.30
8.2.100.0040.00718.09
8.2.90.0000.00819.22
8.2.80.0040.00418.05
8.2.70.0040.00417.75
8.2.60.0080.00017.80
8.2.50.0000.00818.07
8.2.40.0030.00517.97
8.2.30.0040.00418.20
8.2.20.0070.00017.87
8.2.10.0040.00417.70
8.2.00.0080.00017.70
8.1.280.0040.01125.92
8.1.270.0090.00022.15
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.01023.92
8.1.230.0090.00319.05
8.1.220.0000.00817.74
8.1.210.0040.00418.77
8.1.200.0030.00617.48
8.1.190.0060.00317.52
8.1.180.0050.00318.10
8.1.170.0000.00818.91
8.1.160.0070.00422.09
8.1.150.0000.00818.86
8.1.140.0000.00817.66
8.1.130.0060.00319.29
8.1.120.0050.00317.68
8.1.110.0040.00417.61
8.1.100.0020.00517.67
8.1.90.0000.00717.50
8.1.80.0000.00817.66
8.1.70.0040.00417.64
8.1.60.0040.00417.64
8.1.50.0040.00417.58
8.1.40.0000.00817.74
8.1.30.0040.00417.69
8.1.20.0030.00617.73
8.1.10.0040.00417.73
8.1.00.0030.00617.58
8.0.300.0040.00418.77
8.0.290.0000.00717.43
8.0.280.0070.00018.56
8.0.270.0030.00317.21
8.0.260.0030.00317.14
8.0.250.0070.00017.22
8.0.240.0030.00617.10
8.0.230.0070.00017.23
8.0.220.0070.00017.16
8.0.210.0040.00417.20
8.0.200.0070.00317.22
8.0.190.0050.00317.11
8.0.180.0050.00217.09
8.0.170.0030.00617.12
8.0.160.0080.00017.29
8.0.150.0040.00417.14
8.0.140.0040.00417.04
8.0.130.0070.00013.61
8.0.120.0040.00417.18
8.0.110.0000.00717.21
8.0.100.0040.00417.27
8.0.90.0080.00017.04
8.0.80.0080.00817.11
8.0.70.0030.00517.22
8.0.60.0000.00716.95
8.0.50.0000.00816.97
8.0.30.0160.00517.22
8.0.20.0110.00917.45
8.0.10.0030.00517.12
8.0.00.0100.01016.86
7.4.330.0050.00015.05
7.4.320.0030.00316.81
7.4.300.0040.00416.89
7.4.290.0050.00316.88
7.4.280.0000.00816.68
7.4.270.0050.00316.88
7.4.260.0000.00716.77
7.4.250.0060.00316.75
7.4.240.0010.00716.90
7.4.230.0040.00416.98
7.4.220.0090.00916.73
7.4.210.0120.00716.83
7.4.200.0000.00716.62
7.4.190.0050.00316.72
7.4.160.0100.01316.83
7.4.150.0190.00017.40
7.4.140.0130.00617.86
7.4.130.0080.00816.81
7.4.120.0080.01016.78
7.4.110.0090.00916.85
7.4.100.0090.00916.76
7.4.90.0140.01316.68
7.4.80.0060.01319.39
7.4.70.0100.00716.68
7.4.60.0040.01316.82
7.4.50.0040.00416.58
7.4.40.0040.01522.77
7.4.30.0060.01016.64
7.4.00.0070.01115.23
7.3.330.0000.00613.48
7.3.320.0030.00313.34
7.3.310.0030.00316.53
7.3.300.0030.00316.38
7.3.290.0130.00516.52
7.3.280.0140.00416.49
7.3.270.0120.00617.40
7.3.260.0130.01216.80
7.3.250.0100.00716.68
7.3.240.0120.00616.49
7.3.230.0090.00916.58
7.3.210.0100.00716.61
7.3.200.0120.01219.39
7.3.190.0120.00616.80
7.3.180.0080.00816.53
7.3.170.0070.01016.73
7.3.160.0130.00316.66
7.3.120.0070.00715.07
7.2.330.0140.00716.89
7.2.320.0090.01516.68
7.2.310.0090.00916.69
7.2.300.0080.01516.59
7.2.290.0160.00016.95
7.1.70.0040.00716.98
7.1.60.0100.01019.29
7.1.50.0210.01517.25
7.1.00.0030.07722.33
7.0.200.0090.00316.61
7.0.140.0030.07321.96
7.0.100.0030.03319.94
7.0.90.0170.03019.91
7.0.80.0130.05320.00
7.0.70.0200.07720.04
7.0.60.0070.07319.90
7.0.50.0070.04320.38
7.0.40.0230.05720.08
7.0.30.0000.06320.07
7.0.20.0030.06020.08
7.0.10.0170.08720.09
7.0.00.0030.07720.16
5.6.280.0030.07721.17
5.6.250.0030.04020.68
5.6.240.0070.03320.65
5.6.230.0130.06720.69
5.6.220.0070.03720.63
5.6.210.0170.04320.62
5.6.200.0070.06021.15
5.6.190.0130.06721.12
5.6.180.0100.05721.04
5.6.170.0000.04321.12
5.6.160.0030.06021.06
5.6.150.0030.05721.03
5.6.140.0030.04321.10
5.6.130.0100.08321.07
5.6.120.0100.08021.08
5.6.110.0030.04321.04
5.6.100.0030.06321.18
5.6.90.0130.03721.05
5.6.80.0030.04320.40
5.6.70.0070.06020.43
5.6.60.0100.07720.51
5.6.50.0170.06720.43
5.6.40.0070.05720.54
5.6.30.0170.04020.43
5.6.20.0030.07020.38
5.6.10.0070.07020.37
5.6.00.0130.07320.31
5.5.380.0070.03020.43
5.5.370.0030.03720.52
5.5.360.0070.07320.50
5.5.350.0130.05720.40
5.5.340.0070.06320.82
5.5.330.0100.06720.94
5.5.320.0030.03720.79
5.5.310.0030.07320.79
5.5.300.0030.04020.91
5.5.290.0070.08320.87
5.5.280.0070.04320.93
5.5.270.0030.08720.91
5.5.260.0130.06320.93
5.5.250.0130.06320.61
5.5.240.0070.06720.33
5.5.230.0030.04320.18
5.5.220.0100.07720.31
5.5.210.0100.06720.17
5.5.200.0100.07720.28
5.5.190.0070.05320.25
5.5.180.0070.05020.23
5.5.160.0070.07720.25
5.5.150.0070.07320.12
5.5.140.0070.04020.28
5.5.130.0100.04720.27
5.5.120.0030.08020.12
5.5.110.0000.08720.15
5.5.100.0170.07020.09
5.5.90.0130.05320.18
5.5.80.0070.04320.05
5.5.70.0030.04320.10
5.5.60.0030.04020.09
5.5.50.0070.04320.17
5.5.40.0070.07720.04
5.5.30.0070.07320.06
5.5.20.0070.07019.93
5.5.10.0030.03720.04
5.5.00.0030.04720.02
5.4.450.0030.07719.47
5.4.440.0070.03719.48
5.4.430.0170.06019.56
5.4.420.0130.04719.55
5.4.410.0000.04719.24
5.4.400.0130.07318.85
5.4.390.0130.05718.87
5.4.380.0170.07319.03
5.4.370.0100.03318.93
5.4.360.0100.05019.14
5.4.350.0070.06019.04
5.4.340.0000.05018.85
5.4.320.0070.06719.04
5.4.310.0070.08018.91
5.4.300.0000.05018.87
5.4.290.0070.07319.04
5.4.280.0000.05319.18
5.4.270.0030.07319.16
5.4.260.0070.06719.09
5.4.250.0070.07719.13
5.4.240.0030.03719.04
5.4.230.0000.04719.03
5.4.220.0100.06318.84
5.4.210.0100.07019.02
5.4.200.0030.06319.13
5.4.190.0100.07319.13
5.4.180.0100.07019.06
5.4.170.0130.03319.08
5.4.160.0130.07019.18
5.4.150.0100.07318.86
5.4.140.0030.03716.36
5.4.130.0030.04016.43
5.4.120.0170.05316.49
5.4.110.0030.08016.47
5.4.100.0070.04716.45
5.4.90.0070.06716.39
5.4.80.0030.04316.34
5.4.70.0030.06716.34
5.4.60.0100.04016.46
5.4.50.0070.05316.44
5.4.40.0100.05716.41
5.4.30.0030.04316.25
5.4.20.0070.05016.36
5.4.10.0100.07016.47
5.4.00.0030.08015.79
5.3.290.0030.07014.69
5.3.280.0000.05014.70
5.3.270.0030.05714.57
5.3.260.0030.07014.61
5.3.250.0030.07714.68
5.3.240.0000.07014.64
5.3.230.0000.04014.54
5.3.220.0030.03714.50
5.3.210.0100.07314.55
5.3.200.0070.05314.64
5.3.190.0130.06714.68
5.3.180.0100.06714.64
5.3.170.0030.04014.63
5.3.160.0070.03314.51
5.3.150.0100.06014.53
5.3.140.0170.03314.59
5.3.130.0070.04314.67
5.3.120.0030.07714.55
5.3.110.0030.04714.57
5.3.100.0100.04714.14
5.3.90.0070.07314.05
5.3.80.0030.05714.15
5.3.70.0070.03713.96
5.3.60.0070.06714.01
5.3.50.0030.05013.96
5.3.40.0130.04314.10
5.3.30.0000.08013.89
5.3.20.0000.04713.84
5.3.10.0100.06713.60
5.3.00.0100.03313.59
5.2.170.0000.04311.69
5.2.160.0030.06311.69
5.2.150.0030.05311.69
5.2.140.0000.03711.69
5.2.130.0030.03011.69
5.2.120.0030.02711.69
5.2.110.0070.02711.69
5.2.100.0000.05011.69
5.2.90.0030.02711.69
5.2.80.0000.03311.69
5.2.70.0030.03011.69
5.2.60.0130.05311.69
5.2.50.0100.02311.69
5.2.40.0070.03311.69
5.2.30.0000.04311.69
5.2.20.0000.05311.69
5.2.10.0030.05311.69
5.2.00.0030.02711.69
5.1.60.0070.02011.69
5.1.50.0030.02011.69
5.1.40.0070.03711.69
5.1.30.0030.02311.69
5.1.20.0030.05711.69
5.1.10.0030.04311.69
5.1.00.0070.03711.69
5.0.50.0070.03311.69
5.0.40.0070.03311.69
5.0.30.0000.03311.69
5.0.20.0000.02011.69
5.0.10.0030.03711.69
5.0.00.0030.04311.69
4.4.90.0000.04311.69
4.4.80.0000.04011.69
4.4.70.0070.03011.69
4.4.60.0030.03011.69
4.4.50.0000.03311.69
4.4.40.0000.02311.69
4.4.30.0030.03311.69
4.4.20.0000.01711.69
4.4.10.0000.02011.69
4.4.00.0070.04311.69
4.3.110.0000.02011.69
4.3.100.0070.01011.69
4.3.90.0030.03311.69
4.3.80.0000.04711.69
4.3.70.0030.02011.69
4.3.60.0030.01711.69
4.3.50.0000.03011.69
4.3.40.0030.05311.69
4.3.30.0000.03011.69
4.3.20.0030.03011.69
4.3.10.0030.02011.69
4.3.00.0000.02711.69

preferences:
41.17 ms | 401 KiB | 5 Q