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.0110.00416.88
8.3.50.0150.00717.50
8.3.40.0090.00619.09
8.3.30.0150.00018.84
8.3.20.0000.00818.93
8.3.10.0040.00420.65
8.3.00.0040.00419.50
8.2.180.0110.01116.63
8.2.170.0120.00322.96
8.2.160.0100.00320.47
8.2.150.0040.00424.18
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0040.00422.29
8.2.110.0030.00621.01
8.2.100.0040.00817.98
8.2.90.0030.00519.36
8.2.80.0030.00619.39
8.2.70.0070.00317.88
8.2.60.0040.00417.92
8.2.50.0040.00418.07
8.2.40.0040.00418.29
8.2.30.0040.00418.11
8.2.20.0000.00717.89
8.2.10.0030.00617.82
8.2.00.0000.00817.86
8.1.280.0110.00725.92
8.1.270.0070.00024.66
8.1.260.0030.00526.35
8.1.250.0070.00028.09
8.1.240.0030.00722.59
8.1.230.0040.00721.02
8.1.220.0000.00817.74
8.1.210.0080.00419.08
8.1.200.0030.00617.38
8.1.190.0030.00517.66
8.1.180.0040.00418.10
8.1.170.0050.00518.88
8.1.160.0000.00718.93
8.1.150.0040.00419.00
8.1.140.0040.00417.58
8.1.130.0030.00318.00
8.1.120.0070.00017.68
8.1.110.0030.00517.63
8.1.100.0040.00417.66
8.1.90.0040.00417.64
8.1.80.0030.00517.66
8.1.70.0060.00317.55
8.1.60.0000.00817.73
8.1.50.0000.00917.69
8.1.40.0060.00317.71
8.1.30.0030.00617.84
8.1.20.0040.00417.72
8.1.10.0030.00617.59
8.1.00.0040.00417.56
8.0.300.0040.00419.98
8.0.290.0040.00417.00
8.0.280.0040.00418.52
8.0.270.0070.00017.32
8.0.260.0030.00316.92
8.0.250.0040.00417.04
8.0.240.0070.00017.18
8.0.230.0030.00317.14
8.0.220.0000.00717.15
8.0.210.0110.00016.99
8.0.200.0030.00317.11
8.0.190.0040.00417.14
8.0.180.0000.00717.02
8.0.170.0000.00817.09
8.0.160.0000.00717.17
8.0.150.0000.00816.96
8.0.140.0050.00816.99
8.0.130.0030.00313.42
8.0.120.0040.00417.14
8.0.110.0030.00517.00
8.0.100.0000.00717.26
8.0.90.0070.00017.01
8.0.80.0120.00917.20
8.0.70.0050.00316.97
8.0.60.0000.00817.17
8.0.50.0030.00517.00
8.0.30.0140.00717.00
8.0.20.0120.00817.44
8.0.10.0050.00217.29
8.0.00.0060.01317.10
7.4.330.0000.00513.32
7.4.320.0060.00016.80
7.4.300.0060.00016.80
7.4.290.0000.00716.88
7.4.280.0000.00816.88
7.4.270.0000.00716.95
7.4.260.0030.00313.57
7.4.250.0000.00816.82
7.4.240.0070.00016.93
7.4.230.0070.00017.02
7.4.220.0090.01816.80
7.4.210.0090.00617.00
7.4.200.0020.00516.57
7.4.190.0040.00416.95
7.4.160.0120.00416.75
7.4.150.0100.01416.75
7.4.140.0090.00916.74
7.4.130.0090.01216.65
7.4.120.0120.00616.80
7.4.110.0130.01016.97
7.4.100.0170.00716.64
7.4.90.0050.01416.82
7.4.80.0140.00316.87
7.4.70.0220.00016.93
7.4.60.0120.00916.81
7.4.50.0100.00316.45
7.4.40.0090.00916.73
7.4.30.0090.00616.73
7.4.00.0040.01115.21
7.3.330.0080.00013.34
7.3.320.0030.00313.37
7.3.310.0020.00516.42
7.3.300.0030.00316.24
7.3.290.0040.01416.41
7.3.280.0090.00816.45
7.3.270.0080.01016.84
7.3.260.0100.00716.88
7.3.250.0120.00616.63
7.3.240.0000.01616.54
7.3.230.0070.01016.68
7.3.210.0060.01616.68
7.3.200.0160.00319.39
7.3.190.0000.02116.77
7.3.180.0160.00016.65
7.3.170.0000.01816.42
7.3.160.0120.00816.72
7.3.120.0090.00314.88
7.2.330.0090.00916.80
7.2.320.0120.00816.79
7.2.310.0160.00616.86
7.2.300.0150.00316.79
7.2.290.0090.00816.84
7.2.00.0070.00719.87
7.1.100.0030.00918.51
7.1.70.0000.01517.39
7.1.60.0100.01419.40
7.1.50.0030.01317.13
7.1.00.0030.03322.30
7.0.200.0050.00514.84
7.0.140.0070.06722.11
7.0.120.0130.06322.09
7.0.60.0030.05720.05
7.0.50.0100.03317.91
7.0.40.0000.04317.88
7.0.30.0070.07017.83
7.0.20.0030.04717.88
7.0.10.0000.05717.77
7.0.00.0030.04017.88
5.6.280.0000.07721.00
5.6.210.0000.07720.70
5.6.200.0030.04018.12
5.6.190.0070.03718.12
5.6.180.0030.04018.27
5.6.170.0000.06018.19
5.6.160.0100.07718.14
5.6.150.0200.05318.18
5.6.140.0030.04018.14
5.6.130.0030.04318.16
5.6.120.0000.04318.14
5.6.110.0070.03718.17
5.6.100.0070.04018.15
5.6.90.0070.08018.13
5.6.80.0100.04717.53
5.6.70.0030.07317.64
5.6.60.0070.03717.52
5.6.50.0070.07717.61
5.6.40.0070.03717.60
5.6.30.0000.04317.51
5.6.20.0100.06017.52
5.6.10.0070.08317.54
5.6.00.0170.06717.59
5.5.350.0300.06720.44
5.5.340.0000.04018.09
5.5.330.0030.04017.92
5.5.320.0000.04317.99
5.5.310.0030.04018.03
5.5.300.0000.06017.97
5.5.290.0000.06018.05
5.5.280.0000.04717.95
5.5.270.0030.05018.08
5.5.260.0030.04317.95
5.5.250.0100.06717.86
5.5.240.0030.05317.38
5.5.230.0130.07717.34
5.5.220.0070.04017.46
5.5.210.0030.04317.34
5.5.200.0100.07017.41
5.5.190.0000.04717.42
5.5.180.0100.05717.34
5.5.160.0100.06317.31
5.5.150.0100.05017.30
5.5.140.0130.06017.32
5.5.130.0070.07017.38
5.5.120.0030.06317.34
5.5.110.0170.05317.30
5.5.100.0100.08017.19
5.5.90.0100.07317.34
5.5.80.0070.07317.28
5.5.70.0170.06017.32
5.5.60.0000.07017.31
5.5.50.0030.07317.29
5.5.40.0030.05017.16
5.5.30.0000.06017.21
5.5.20.0100.06317.22
5.5.10.0100.07017.23
5.5.00.0000.07717.17
5.4.450.0100.06719.38
5.4.440.0000.04319.60
5.4.430.0100.08019.30
5.4.420.0100.03319.41
5.4.410.0100.08319.23
5.4.400.0070.07719.04
5.4.390.0100.07319.01
5.4.380.0070.04319.01
5.4.370.0070.06319.01
5.4.360.0170.03019.06
5.4.350.0030.04718.88
5.4.340.0130.07318.88
5.4.320.0130.07019.14
5.4.310.0030.04319.02
5.4.300.0000.04318.95
5.4.290.0030.04018.94
5.4.280.0030.08019.01
5.4.270.0070.08019.09
5.4.260.0130.07019.11
5.4.250.0070.05019.26
5.4.240.0070.08019.11
5.4.230.0000.04319.03
5.4.220.0030.08319.09
5.4.210.0130.05319.11
5.4.200.0070.08019.02
5.4.190.0100.06719.09
5.4.180.0130.03318.98
5.4.170.0130.05719.01
5.4.160.0100.07318.86
5.4.150.0130.07019.10
5.4.140.0070.07316.35
5.4.130.0070.05016.58
5.4.120.0170.06316.62
5.4.110.0030.04716.52
5.4.100.0030.07716.63
5.4.90.0070.05316.60
5.4.80.0070.07716.59
5.4.70.0030.07716.44
5.4.60.0000.07316.38
5.4.50.0030.07316.35
5.4.40.0100.05016.50
5.4.30.0100.06316.32
5.4.20.0070.06016.45
5.4.10.0130.06016.34
5.4.00.0070.05715.81
5.3.290.0100.07014.74
5.3.280.0030.04714.45
5.3.270.0100.05014.66
5.3.260.0070.08014.60
5.3.250.0030.08314.63
5.3.240.0070.07314.60
5.3.230.0100.03714.45
5.3.220.0030.04314.63
5.3.210.0130.04014.63
5.3.200.0100.07714.60
5.3.190.0030.04714.62
5.3.180.0070.05314.78
5.3.170.0200.03714.41
5.3.160.0030.05314.61
5.3.150.0030.08014.52
5.3.140.0000.07314.59
5.3.130.0170.04314.57
5.3.120.0100.07314.58
5.3.110.0130.07014.52
5.3.100.0300.02714.04
5.3.90.0130.03314.22
5.3.80.0030.04014.06
5.3.70.0030.04014.04
5.3.60.0070.03313.99
5.3.50.0130.06313.94
5.3.40.0030.05714.01
5.3.30.0030.03713.95
5.3.20.0030.03713.54
5.3.10.0000.04013.67
5.3.00.0030.05013.65
5.2.170.0070.04311.25
5.2.160.0070.06011.18
5.2.150.0070.04011.36
5.2.140.0000.03311.19
5.2.130.0100.02311.10
5.2.120.0070.03711.14
5.2.110.0100.05311.12
5.2.100.0030.04311.15
5.2.90.0030.07011.13
5.2.80.0030.05011.09
5.2.70.0100.05711.13
5.2.60.0000.04010.90
5.2.50.0130.05311.05
5.2.40.0030.06011.04
5.2.30.0030.06310.94
5.2.20.0100.04311.03
5.2.10.0100.05310.91
5.2.00.0100.05310.77
5.1.60.0030.05710.04
5.1.50.0070.0339.96
5.1.40.0100.0509.93
5.1.30.0000.04710.38
5.1.20.0070.05710.41
5.1.10.0070.03310.08
5.1.00.0030.05310.00
5.0.50.0030.0308.93
5.0.40.0000.0238.93
5.0.30.0030.0638.93
5.0.20.0030.0208.93
5.0.10.0000.0308.93
5.0.00.0030.0638.93
4.4.90.0000.0208.93
4.4.80.0000.0208.93
4.4.70.0000.0408.93
4.4.60.0000.0308.93
4.4.50.0100.0278.93
4.4.40.0100.0508.93
4.4.30.0000.0278.93
4.4.20.0030.0238.93
4.4.10.0000.0338.93
4.4.00.0070.0238.93
4.3.110.0000.0208.93
4.3.100.0030.0378.93
4.3.90.0030.0208.93
4.3.80.0030.0478.93
4.3.70.0100.0278.93
4.3.60.0030.0238.93
4.3.50.0000.0378.93
4.3.40.0030.0478.93
4.3.30.0000.0378.93
4.3.20.0000.0338.93
4.3.10.0030.0278.93
4.3.00.0070.0178.93

preferences:
41.62 ms | 401 KiB | 5 Q