3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { $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/*"). 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.0090.00618.38
8.3.50.0140.00316.71
8.3.40.0040.01118.96
8.3.30.0170.00319.06
8.3.20.0050.00318.69
8.3.10.0040.00420.46
8.3.00.0080.00017.63
8.2.180.0180.00316.88
8.2.170.0180.00322.96
8.2.160.0100.00322.39
8.2.150.0000.00824.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0080.00019.95
8.2.110.0100.00019.27
8.2.100.0060.00617.82
8.2.90.0080.00019.01
8.2.80.0050.00318.05
8.2.70.0000.00917.88
8.2.60.0000.00817.93
8.2.50.0060.00318.10
8.2.40.0050.00220.57
8.2.30.0050.00319.28
8.2.20.0040.00417.86
8.2.10.0000.00917.88
8.2.00.0000.00917.82
8.1.280.0040.01125.92
8.1.270.0200.00023.99
8.1.260.0090.01226.35
8.1.250.0030.00528.09
8.1.240.0000.00921.29
8.1.230.0090.00319.36
8.1.220.0030.00517.79
8.1.210.0040.00418.77
8.1.200.0060.00317.60
8.1.190.0000.00817.50
8.1.180.0000.00818.10
8.1.170.0040.00418.89
8.1.160.0040.00418.84
8.1.150.0030.00622.08
8.1.140.0030.00517.66
8.1.130.0030.00317.87
8.1.120.0000.00717.55
8.1.110.0030.00617.57
8.1.100.0030.00617.57
8.1.90.0040.00417.64
8.1.80.0000.00717.64
8.1.70.0030.00317.51
8.1.60.0030.00617.77
8.1.50.0080.00017.62
8.1.40.0050.00317.63
8.1.30.0040.00417.76
8.1.20.0040.00417.84
8.1.10.0000.00917.71
8.1.00.0060.00317.66
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0030.00318.39
8.0.270.0030.00317.32
8.0.260.0030.00316.98
8.0.250.0030.00717.06
8.0.240.0030.00817.13
8.0.230.0000.00717.12
8.0.220.0070.00017.00
8.0.210.0040.00417.03
8.0.200.0070.00017.01
8.0.190.0000.00817.16
8.0.180.0000.00717.12
8.0.170.0060.00317.18
8.0.160.0050.00317.20
8.0.150.0040.00417.02
8.0.140.0070.00717.05
8.0.130.0030.00313.51
8.0.120.0070.00017.05
8.0.110.0000.00817.09
8.0.100.0080.00017.13
8.0.90.0040.00417.04
8.0.80.0100.01116.97
8.0.70.0040.00416.99
8.0.60.0030.00516.96
8.0.50.0080.00017.03
8.0.30.0140.00517.29
8.0.20.0070.01217.19
8.0.10.0040.00416.95
8.0.00.0110.01017.12
7.4.330.0030.00314.87
7.4.320.0000.00716.81
7.4.300.0000.00716.88
7.4.290.0000.00716.84
7.4.280.0000.00816.87
7.4.270.0070.00016.70
7.4.260.0030.00513.51
7.4.250.0080.00016.80
7.4.240.0070.00016.87
7.4.230.0050.00316.88
7.4.220.0060.01216.82
7.4.210.0070.00716.80
7.4.200.0000.00716.88
7.4.190.0000.00716.96
7.4.160.0060.01016.93
7.4.150.0120.00617.18
7.4.140.0110.01017.20
7.4.130.0070.01116.69
7.4.120.0100.01116.67
7.4.110.0120.00916.89
7.4.100.0150.00316.77
7.4.90.0000.02516.67
7.4.80.0090.00918.80
7.4.70.0170.01016.84
7.4.60.0070.01016.91
7.4.50.0000.00816.76
7.4.40.0000.01122.27
7.4.30.0100.01316.61
7.4.00.0090.00615.29
7.3.330.0040.00313.21
7.3.320.0030.00313.43
7.3.310.0000.00716.49
7.3.300.0000.00716.36
7.3.290.0100.00316.53
7.3.280.0070.01016.42
7.3.270.0070.01017.18
7.3.260.0070.01018.24
7.3.250.0150.00616.65
7.3.240.0130.01016.50
7.3.230.0130.00316.51
7.3.210.0120.00616.36
7.3.200.0060.01619.39
7.3.190.0130.00716.90
7.3.180.0080.00816.92
7.3.170.0040.01416.39
7.3.160.0060.01016.46
7.3.120.0060.00614.85
7.2.330.0030.01716.81
7.2.320.0090.00616.83
7.2.310.0060.01716.76
7.2.300.0110.00716.57
7.2.290.0060.01016.82
7.1.70.0030.00617.35
7.1.60.0060.01919.40
7.1.50.0090.01217.04
7.1.00.0100.07022.42
7.0.200.0030.00516.84
7.0.140.0030.07321.91
7.0.60.0070.08019.95
7.0.50.0070.08017.98
7.0.40.0100.06717.71
7.0.30.0000.09017.79
7.0.20.0100.07717.75
7.0.10.0100.04017.82
7.0.00.0030.06017.77
5.6.280.0100.06320.92
5.6.210.0100.05720.77
5.6.200.0100.07718.29
5.6.190.0170.07718.18
5.6.180.0130.05718.21
5.6.170.0100.08318.21
5.6.160.0070.07718.33
5.6.150.0130.08018.19
5.6.140.0100.07018.21
5.6.130.0030.08018.21
5.6.120.0100.08318.18
5.6.110.0130.05318.20
5.6.100.0170.06318.27
5.6.90.0000.04718.14
5.6.80.0130.06317.53
5.6.70.0100.06717.66
5.6.60.0070.03717.54
5.6.50.0030.05017.58
5.6.40.0070.07717.66
5.6.30.0130.06717.55
5.6.20.0070.03717.57
5.6.10.0000.04017.56
5.6.00.0170.05017.50
5.5.350.4230.03320.32
5.5.340.0070.04018.09
5.5.330.0100.08018.02
5.5.320.0070.08017.92
5.5.310.0100.07317.95
5.5.300.0070.07717.99
5.5.290.0070.08017.98
5.5.280.0130.07317.99
5.5.270.0070.07717.91
5.5.260.0130.08018.02
5.5.250.0130.07317.76
5.5.240.0070.07317.34
5.5.230.0070.03717.33
5.5.220.0070.03717.37
5.5.210.0070.04717.33
5.5.200.0000.05017.35
5.5.190.0100.06017.36
5.5.180.0070.06717.30
5.5.160.0100.08017.34
5.5.150.0070.07317.29
5.5.140.0100.07017.38
5.5.130.0230.05717.32
5.5.120.0070.04317.43
5.5.110.0030.04317.39
5.5.100.0030.07717.34
5.5.90.0030.04017.23
5.5.80.0070.04017.23
5.5.70.0100.07317.21
5.5.60.0070.07317.22
5.5.50.0070.05717.19
5.5.40.0100.05317.16
5.5.30.0070.07317.21
5.5.20.0100.05017.38
5.5.10.0100.03717.18
5.5.00.0100.06317.21
5.4.450.0130.05019.28
5.4.440.0130.06319.31
5.4.430.0070.04719.34
5.4.420.0100.07719.45
5.4.410.0170.06719.25
5.4.400.0130.07018.89
5.4.390.0130.04019.05
5.4.380.0130.04319.11
5.4.370.0130.07019.02
5.4.360.0100.07319.14
5.4.350.0130.04319.05
5.4.340.0030.03719.04
5.4.320.0000.05018.89
5.4.310.0070.07719.05
5.4.300.0100.07019.09
5.4.290.0030.08319.09
5.4.280.0100.05019.13
5.4.270.0030.05319.04
5.4.260.0170.04718.99
5.4.250.0030.07719.03
5.4.240.0170.04719.03
5.4.230.0030.07019.11
5.4.220.0130.04319.07
5.4.210.0100.07019.09
5.4.200.0030.05719.01
5.4.190.0070.08019.11
5.4.180.0170.07019.26
5.4.170.0030.04719.02
5.4.160.0030.06319.09
5.4.150.0030.04318.97
5.4.140.0100.06316.44
5.4.130.0070.07016.39
5.4.120.0070.07716.24
5.4.110.0100.07016.43
5.4.100.0130.06316.38
5.4.90.0000.06716.45
5.4.80.0030.06716.46
5.4.70.0130.06316.23
5.4.60.0000.05316.36
5.4.50.0030.06316.37
5.4.40.0100.03716.26
5.4.30.0070.07316.56
5.4.20.0070.07316.27
5.4.10.0100.04716.27
5.4.00.0030.04715.73
5.3.290.0100.07714.71
5.3.280.0030.06014.58
5.3.270.0070.05714.46
5.3.260.0030.06714.64
5.3.250.0030.08014.57
5.3.240.0130.05014.64
5.3.230.0070.07714.62
5.3.220.0030.08014.61
5.3.210.0130.07014.64
5.3.200.0030.05014.53
5.3.190.0170.06714.53
5.3.180.0070.04714.57
5.3.170.0070.04314.57
5.3.160.0030.08014.60
5.3.150.0030.04314.61
5.3.140.0070.07314.63
5.3.130.0130.05714.59
5.3.120.0070.06014.54
5.3.110.0130.07014.65
5.3.100.0130.07313.88
5.3.90.0030.07313.99
5.3.80.0030.07714.01
5.3.70.0130.05014.04
5.3.60.0070.05713.88
5.3.50.0000.08013.79
5.3.40.0100.07313.86
5.3.30.0070.04013.95
5.3.20.0070.04713.69
5.3.10.0070.07013.67
5.3.00.0000.06313.66
5.2.170.0030.05011.01
5.2.160.0030.03711.37
5.2.150.0100.03711.19
5.2.140.0030.03711.25
5.2.130.0170.04011.10
5.2.120.0030.05011.16
5.2.110.0070.04011.15
5.2.100.0000.03711.01
5.2.90.0030.05711.01
5.2.80.0070.04711.14
5.2.70.0030.06711.17
5.2.60.0070.05711.16
5.2.50.0030.04711.07
5.2.40.0070.02311.09
5.2.30.0070.05710.89
5.2.20.0070.05010.97
5.2.10.0030.03011.08
5.2.00.0030.06010.77
5.1.60.0030.05010.05
5.1.50.0070.04710.06
5.1.40.0070.04010.08
5.1.30.0030.03710.45
5.1.20.0000.04310.38
5.1.10.0030.03010.07
5.1.00.0100.03010.19
5.0.50.0000.0408.63
5.0.40.0000.0478.42
5.0.30.0030.0438.42
5.0.20.0030.0438.42
5.0.10.0070.0438.42
5.0.00.0030.0578.42
4.4.90.0000.0308.42
4.4.80.0030.0378.42
4.4.70.0000.0178.42
4.4.60.0000.0378.42
4.4.50.0070.0178.42
4.4.40.0000.0508.42
4.4.30.0070.0278.42
4.4.20.0070.0138.42
4.4.10.0000.0378.42
4.4.00.0070.0508.42
4.3.110.0030.0308.42
4.3.100.0100.0278.42
4.3.90.0000.0308.42
4.3.80.0000.0578.42
4.3.70.0100.0238.42
4.3.60.0030.0278.42
4.3.50.0030.0178.42
4.3.40.0000.0338.42
4.3.30.0000.0378.42
4.3.20.0000.0408.42
4.3.10.0070.0238.42
4.3.00.0100.0278.42

preferences:
61.5 ms | 401 KiB | 5 Q