3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { echo preg_match('/[\?#]/',$url); if (substr($url, -1) == "*" && preg_match('/[\?#]/',$url)) { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\/|\*]+)?$/i', "$1(?:$|((?:\/(?:home|default|index)\..{3,4})|\/?[\?#]+.*))$2", $url); } else { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\?|\/|#]+.*)*$/i', "$1(?:$|((?:\/(?:home|default|index)\..{3,4})|\/?[\?#]))$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?a=1"). 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.00716.88
8.3.50.0160.00517.70
8.3.40.0070.00719.04
8.3.30.0110.00418.97
8.3.20.0040.00718.89
8.3.10.0040.00420.60
8.3.00.0080.00819.63
8.2.180.0100.00616.47
8.2.170.0040.01422.96
8.2.160.0070.00721.36
8.2.150.0000.00825.66
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00420.52
8.2.110.0060.00321.14
8.2.100.0070.00417.97
8.2.90.0060.00319.42
8.2.80.0000.00919.28
8.2.70.0030.00617.75
8.2.60.0040.00417.93
8.2.50.0080.00018.07
8.2.40.0050.00318.34
8.2.30.0000.00718.00
8.2.20.0000.00718.01
8.2.10.0000.00817.96
8.2.00.0020.00517.84
8.1.280.0000.01425.92
8.1.270.0040.00424.66
8.1.260.0110.00726.35
8.1.250.0000.00828.09
8.1.240.0000.00923.96
8.1.230.0040.00720.97
8.1.220.0000.00817.91
8.1.210.0060.00319.00
8.1.200.0000.01017.60
8.1.190.0050.00317.64
8.1.180.0040.00418.10
8.1.170.0000.00819.01
8.1.160.0040.00418.98
8.1.150.0030.00518.88
8.1.140.0050.00317.72
8.1.130.0000.00717.95
8.1.120.0070.00017.64
8.1.110.0000.00717.62
8.1.100.0000.00717.51
8.1.90.0000.00717.70
8.1.80.0080.00017.63
8.1.70.0070.00017.63
8.1.60.0000.00817.74
8.1.50.0060.00317.56
8.1.40.0040.00417.65
8.1.30.0050.00317.85
8.1.20.0040.00417.82
8.1.10.0050.00317.61
8.1.00.0040.00417.51
8.0.300.0000.00720.11
8.0.290.0000.00716.88
8.0.280.0030.00318.51
8.0.270.0030.00317.32
8.0.260.0070.00017.00
8.0.250.0000.00817.14
8.0.240.0080.00017.18
8.0.230.0000.00817.02
8.0.220.0060.00317.05
8.0.210.0000.00817.08
8.0.200.0030.00317.03
8.0.190.0040.00417.05
8.0.180.0050.00317.01
8.0.170.0040.00417.12
8.0.160.0040.00417.13
8.0.150.0050.00517.05
8.0.140.0030.01017.04
8.0.130.0060.00013.52
8.0.120.0000.00717.09
8.0.110.0040.00417.04
8.0.100.0080.00017.10
8.0.90.0040.00417.13
8.0.80.0060.00917.21
8.0.70.0030.00616.95
8.0.60.0030.00517.13
8.0.50.0050.00316.98
8.0.30.0220.00317.46
8.0.20.0180.02517.46
8.0.10.0040.00417.10
8.0.00.0130.00916.82
7.4.330.0000.00513.33
7.4.320.0070.00016.85
7.4.300.0000.00616.71
7.4.290.0030.00316.82
7.4.280.0040.00416.75
7.4.270.0060.00316.91
7.4.260.0030.00313.62
7.4.250.0030.00616.82
7.4.240.0000.00816.98
7.4.230.0040.00416.80
7.4.220.0160.01016.95
7.4.210.0070.01016.92
7.4.200.0000.00716.57
7.4.190.0040.00416.81
7.4.160.0170.00016.77
7.4.150.0100.01016.77
7.4.140.0130.00816.71
7.4.130.0110.00916.79
7.4.120.0010.01816.71
7.4.110.0060.01016.80
7.4.100.0040.01516.88
7.4.90.0030.01417.00
7.4.80.0060.01219.39
7.4.70.0070.01016.93
7.4.60.0130.00316.73
7.4.50.0030.01016.82
7.4.40.0100.00616.64
7.4.30.0130.00616.75
7.4.00.0030.01315.26
7.3.330.0040.00413.49
7.3.320.0030.00313.45
7.3.310.0030.00316.51
7.3.300.0000.00716.37
7.3.290.0070.00716.50
7.3.280.0110.00516.42
7.3.270.0160.00316.50
7.3.260.0130.01016.50
7.3.250.0100.01316.66
7.3.240.0120.01216.55
7.3.230.0100.01116.89
7.3.210.0130.00316.71
7.3.200.0110.01116.52
7.3.190.0060.01216.53
7.3.180.0090.00616.60
7.3.170.0030.01216.78
7.3.160.0120.00516.52
7.3.120.0040.01115.17
7.2.330.0060.01616.94
7.2.320.0150.00516.78
7.2.310.0060.01916.83
7.2.300.0030.01316.89
7.2.290.0080.00816.70
7.2.00.0030.00919.73
7.1.100.0100.00718.48
7.1.70.0090.00317.04
7.1.60.0110.01519.40
7.1.50.0100.01016.83
7.1.00.0030.03322.47
7.0.200.0040.00815.07
7.0.140.0030.07321.96
7.0.120.0000.07722.25
7.0.60.0070.07719.80
7.0.50.0000.04717.90
7.0.40.0000.05017.75
7.0.30.0070.04717.78
7.0.20.0070.08717.88
7.0.10.0070.06717.87
7.0.00.0130.08017.75
5.6.280.0130.06021.10
5.6.210.0230.05720.69
5.6.200.0030.08718.22
5.6.190.0100.05018.29
5.6.180.0130.07318.29
5.6.170.0070.08318.21
5.6.160.0070.05718.27
5.6.150.0100.06718.29
5.6.140.0070.04018.23
5.6.130.0030.05018.14
5.6.120.0230.07018.21
5.6.110.0070.07718.29
5.6.100.0130.07318.14
5.6.90.0070.08318.16
5.6.80.0100.06717.56
5.6.70.0030.07717.57
5.6.60.0030.08317.56
5.6.50.0100.07717.69
5.6.40.0030.04017.63
5.6.30.0030.05717.51
5.6.20.0070.07317.54
5.6.10.0070.08017.50
5.6.00.0000.08017.63
5.5.350.0270.07320.53
5.5.340.0000.05718.05
5.5.330.0030.04318.08
5.5.320.0000.07017.98
5.5.310.0030.05318.05
5.5.300.0030.04317.98
5.5.290.0100.06717.97
5.5.280.0070.04717.98
5.5.270.0100.08018.08
5.5.260.0030.06017.92
5.5.250.0030.07017.76
5.5.240.0070.08017.34
5.5.230.0100.07717.37
5.5.220.0070.05717.39
5.5.210.0070.04017.40
5.5.200.0100.05017.34
5.5.190.0030.08717.34
5.5.180.0100.05317.33
5.5.160.0070.04317.47
5.5.150.0100.05717.43
5.5.140.0000.05017.34
5.5.130.0070.05717.43
5.5.120.0070.04017.34
5.5.110.0100.03317.36
5.5.100.0100.07317.34
5.5.90.0030.07717.29
5.5.80.0000.05017.25
5.5.70.0000.05017.16
5.5.60.0030.04017.28
5.5.50.0070.03317.22
5.5.40.0200.06717.23
5.5.30.0030.05317.20
5.5.20.0100.04017.32
5.5.10.0000.06717.21
5.5.00.0070.08017.32
5.4.450.0030.08719.45
5.4.440.0100.04319.42
5.4.430.0130.06719.59
5.4.420.0000.05019.37
5.4.410.0130.06719.22
5.4.400.0130.05719.13
5.4.390.0100.06719.01
5.4.380.0100.06719.27
5.4.370.0000.06019.04
5.4.360.0030.05719.27
5.4.350.0070.08019.14
5.4.340.0070.05319.05
5.4.320.0070.06319.13
5.4.310.0130.07018.98
5.4.300.0100.06719.04
5.4.290.0170.06719.13
5.4.280.0030.04319.11
5.4.270.0100.04018.96
5.4.260.0070.04019.00
5.4.250.0070.08018.96
5.4.240.0070.07719.02
5.4.230.0000.06019.02
5.4.220.0100.06718.88
5.4.210.0070.04019.09
5.4.200.0170.04019.02
5.4.190.0030.07018.96
5.4.180.0070.03719.10
5.4.170.0100.04018.97
5.4.160.0130.06019.25
5.4.150.0170.06319.04
5.4.140.0130.04716.47
5.4.130.0000.06316.54
5.4.120.0070.07016.42
5.4.110.0070.05716.48
5.4.100.0170.05016.37
5.4.90.0070.04016.54
5.4.80.0030.04316.42
5.4.70.0030.04016.54
5.4.60.0130.03316.36
5.4.50.0130.06716.54
5.4.40.0000.08316.51
5.4.30.0030.06716.34
5.4.20.0030.07316.20
5.4.10.0100.04016.38
5.4.00.0070.05015.87
5.3.290.0130.07014.52
5.3.280.0230.06314.55
5.3.270.0030.05314.64
5.3.260.0070.05314.63
5.3.250.0130.07014.64
5.3.240.0070.04314.62
5.3.230.0100.07014.55
5.3.220.0070.04714.78
5.3.210.0100.03314.56
5.3.200.0070.04314.58
5.3.190.0030.05314.61
5.3.180.0070.04314.61
5.3.170.0030.04714.61
5.3.160.0000.04714.77
5.3.150.0000.08014.56
5.3.140.0000.07314.57
5.3.130.0170.06014.50
5.3.120.0070.07314.76
5.3.110.0070.05314.65
5.3.100.0170.06314.07
5.3.90.0070.05014.04
5.3.80.0030.07714.04
5.3.70.0070.07714.07
5.3.60.0070.03314.04
5.3.50.0070.04014.16
5.3.40.0030.06714.00
5.3.30.0070.05714.01
5.3.20.0100.06713.77
5.3.10.0100.06713.55
5.3.00.0070.04013.53
5.2.170.0070.06011.04
5.2.160.0000.06711.18
5.2.150.0070.04011.00
5.2.140.0070.06011.19
5.2.130.0100.05711.18
5.2.120.0100.04011.19
5.2.110.0030.03311.07
5.2.100.0070.06011.15
5.2.90.0030.06011.20
5.2.80.0000.06311.12
5.2.70.0070.06311.14
5.2.60.0030.06310.90
5.2.50.0070.05711.23
5.2.40.0030.06011.07
5.2.30.0030.06311.04
5.2.20.0030.03710.97
5.2.10.0030.06010.96
5.2.00.0030.06010.68
5.1.60.0030.0579.93
5.1.50.0070.05310.09
5.1.40.0030.04310.04
5.1.30.0100.03710.30
5.1.20.0100.04310.47
5.1.10.0000.06010.06
5.1.00.0170.04710.05
5.0.50.0030.0308.63
5.0.40.0070.0438.35
5.0.30.0000.0708.33
5.0.20.0100.0238.16
5.0.10.0000.0338.39
5.0.00.0000.0478.38
4.4.90.0000.0237.63
4.4.80.0030.0377.63
4.4.70.0000.0407.63
4.4.60.0000.0337.63
4.4.50.0000.0377.63
4.4.40.0030.0277.63
4.4.30.0000.0407.63
4.4.20.0030.0337.63
4.4.10.0100.0177.63
4.4.00.0000.0607.63
4.3.110.0000.0277.63
4.3.100.0030.0377.63
4.3.90.0100.0277.63
4.3.80.0030.0407.63
4.3.70.0000.0377.63
4.3.60.0030.0237.63
4.3.50.0030.0177.63
4.3.40.0000.0407.63
4.3.30.0000.0337.63
4.3.20.0000.0307.63
4.3.10.0030.0237.63
4.3.00.0030.0177.63

preferences:
47.35 ms | 401 KiB | 5 Q