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.40.0030.01319.14
8.3.30.0040.01118.93
8.3.20.0060.00318.80
8.3.10.0040.00420.71
8.3.00.0030.00517.63
8.2.170.0120.00322.96
8.2.160.0040.01122.13
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0100.00319.95
8.2.110.0060.00319.39
8.2.100.0080.00417.84
8.2.90.0030.00519.27
8.2.80.0030.00517.97
8.2.70.0040.00417.75
8.2.60.0000.00917.80
8.2.50.0080.00018.10
8.2.40.0040.00418.02
8.2.30.0000.00718.03
8.2.20.0040.00417.91
8.2.10.0000.00717.82
8.2.00.0050.00317.82
8.1.270.0000.00723.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0060.00319.50
8.1.230.0040.00717.83
8.1.220.0030.00517.74
8.1.210.0080.00018.77
8.1.200.0080.00017.60
8.1.190.0040.00417.25
8.1.180.0040.00418.10
8.1.170.0000.00819.00
8.1.160.0020.00519.00
8.1.150.0000.00818.88
8.1.140.0040.00417.66
8.1.130.0070.00017.81
8.1.120.0040.00417.59
8.1.110.0000.00817.57
8.1.100.0000.00817.70
8.1.90.0000.00717.66
8.1.80.0000.00717.65
8.1.70.0000.00717.55
8.1.60.0070.00017.70
8.1.50.0050.00217.57
8.1.40.0040.00417.70
8.1.30.0030.00517.86
8.1.20.0090.00017.68
8.1.10.0040.00417.72
8.1.00.0000.00917.66
8.0.300.0030.00618.96
8.0.290.0030.00617.00
8.0.280.0070.00018.52
8.0.270.0000.00817.32
8.0.260.0080.00017.00
8.0.250.0040.00417.07
8.0.240.0030.00717.07
8.0.230.0070.00017.14
8.0.220.0040.00417.06
8.0.210.0000.00716.98
8.0.200.0040.00417.16
8.0.190.0040.00417.19
8.0.180.0040.00417.12
8.0.170.0030.00617.01
8.0.160.0040.00417.07
8.0.150.0060.00317.02
8.0.140.0100.00017.00
8.0.130.0050.00013.54
8.0.120.0040.00417.03
8.0.110.0050.00316.96
8.0.100.0000.00717.04
8.0.90.0070.00016.93
8.0.80.0090.00617.07
8.0.70.0000.00716.98
8.0.60.0050.00316.97
8.0.50.0000.00817.11
8.0.30.0090.01217.13
8.0.20.0110.00817.28
8.0.10.0040.00417.05
8.0.00.0050.01417.11
7.4.330.0030.00314.84
7.4.320.0000.00616.75
7.4.300.0030.00316.76
7.4.290.0040.00416.81
7.4.280.0070.00016.80
7.4.270.0030.00316.85
7.4.260.0000.00713.50
7.4.250.0040.00416.86
7.4.240.0030.00516.89
7.4.230.0040.00416.81
7.4.220.0060.01216.70
7.4.210.0100.00716.84
7.4.200.0050.00316.89
7.4.190.0020.00516.66
7.4.160.0090.01216.80
7.4.150.0070.01017.18
7.4.140.0110.00817.36
7.4.130.0120.00616.83
7.4.120.0100.00816.69
7.4.110.0080.01116.68
7.4.100.0260.00016.79
7.4.90.0150.00316.71
7.4.80.0040.01318.80
7.4.70.0090.00916.75
7.4.60.0110.01116.76
7.4.50.0030.00516.42
7.4.40.0070.00722.27
7.4.30.0060.01516.86
7.4.00.0090.00614.77
7.3.330.0000.00713.42
7.3.320.0030.00213.39
7.3.310.0030.00316.54
7.3.300.0040.00416.30
7.3.290.0040.01116.42
7.3.280.0070.01016.45
7.3.270.0100.00717.18
7.3.260.0100.00718.24
7.3.250.0040.01416.59
7.3.240.0080.01116.56
7.3.230.0120.00416.56
7.3.210.0090.00916.52
7.3.200.0100.00619.39
7.3.190.0180.00616.82
7.3.180.0090.00616.76
7.3.170.0080.00816.87
7.3.160.0110.00616.73
7.3.120.0050.00514.99
7.3.10.0070.00716.65
7.3.00.0070.00716.86
7.2.330.0070.01316.74
7.2.320.0030.01416.95
7.2.310.0060.01316.67
7.2.300.0170.00716.57
7.2.290.0130.00416.92
7.2.130.0070.01016.97
7.2.120.0090.00616.80
7.2.110.0100.00316.97
7.2.100.0030.00716.70
7.2.90.0040.01516.98
7.2.80.0100.00617.20
7.2.70.0040.01117.05
7.2.60.0120.00317.15
7.2.50.0100.00316.93
7.2.40.0090.00317.20
7.2.30.0070.01017.06
7.2.20.0000.01217.16
7.2.10.0070.00717.23
7.2.00.0050.00818.29
7.1.250.0070.00315.83
7.1.200.0060.00615.73
7.1.100.0000.01418.33
7.1.70.0040.00417.48
7.1.60.0070.01419.40
7.1.50.0130.00917.15
7.1.00.0030.07322.30
7.0.200.0030.00516.75
7.0.140.0130.06322.00
7.0.60.0130.08019.96
7.0.50.0030.05717.92
7.0.40.0030.04717.75
7.0.30.0030.08017.74
7.0.20.0070.06017.78
7.0.10.0100.08017.86
7.0.00.0100.06017.78
5.6.280.0100.06721.02
5.6.210.0170.07320.72
5.6.200.0070.07318.20
5.6.190.0070.04718.15
5.6.180.0130.07718.18
5.6.170.0100.08318.18
5.6.160.0030.08018.25
5.6.150.0130.07718.26
5.6.140.0070.05318.15
5.6.130.0100.03718.17
5.6.120.0030.04318.19
5.6.110.0130.03718.14
5.6.100.0030.05318.11
5.6.90.0030.06018.13
5.6.80.0100.07317.57
5.6.70.0030.05317.66
5.6.60.0100.06317.48
5.6.50.0070.06717.57
5.6.40.0070.07017.50
5.6.30.0070.04717.61
5.6.20.0130.07017.49
5.6.10.0030.07717.47
5.6.00.0030.05017.49
5.5.350.0270.08020.41
5.5.340.0130.07318.04
5.5.330.0130.07017.99
5.5.320.0030.08317.97
5.5.310.0200.06317.97
5.5.300.0230.04017.95
5.5.290.0100.04718.03
5.5.280.0000.04317.93
5.5.270.0000.04318.08
5.5.260.0100.03717.95
5.5.250.0000.09017.89
5.5.240.0030.06017.36
5.5.230.0070.06717.40
5.5.220.0100.06017.30
5.5.210.0000.06017.43
5.5.200.0030.07017.31
5.5.190.0070.03717.37
5.5.180.0100.06717.34
5.5.160.0030.04717.33
5.5.150.0070.07717.42
5.5.140.0170.06717.34
5.5.130.0100.04717.41
5.5.120.0130.07717.45
5.5.110.0100.07717.35
5.5.100.0070.07717.32
5.5.90.0030.05317.23
5.5.80.0100.07717.21
5.5.70.0070.08017.23
5.5.60.0100.03317.22
5.5.50.0030.07717.28
5.5.40.0070.04317.19
5.5.30.0070.05017.31
5.5.20.0030.07317.27
5.5.10.0070.06317.18
5.5.00.0030.06717.17
5.4.450.0070.05019.33
5.4.440.0130.03719.44
5.4.430.0100.03319.46
5.4.420.0070.08319.41
5.4.410.0000.05719.37
5.4.400.0000.05319.02
5.4.390.0000.04719.03
5.4.380.0030.06319.02
5.4.370.0030.05019.12
5.4.360.0070.04319.07
5.4.350.0070.06719.12
5.4.340.0000.06019.10
5.4.320.0070.05019.16
5.4.310.0100.03319.05
5.4.300.0100.06319.09
5.4.290.0030.06019.10
5.4.280.0130.03319.07
5.4.270.0100.07319.05
5.4.260.0100.07319.00
5.4.250.0070.04719.02
5.4.240.0170.06319.03
5.4.230.0030.06018.95
5.4.220.0100.05318.95
5.4.210.0070.05319.06
5.4.200.0070.04319.09
5.4.190.0030.07319.16
5.4.180.0130.06719.26
5.4.170.0030.06019.04
5.4.160.0100.05319.14
5.4.150.0030.08019.03
5.4.140.0130.06316.34
5.4.130.0030.06316.38
5.4.120.0130.06716.30
5.4.110.0070.07716.38
5.4.100.0030.07716.47
5.4.90.0130.04016.55
5.4.80.0030.07016.40
5.4.70.0070.03016.21
5.4.60.0000.03716.35
5.4.50.0000.03716.29
5.4.40.0000.03716.43
5.4.30.0000.03716.47
5.4.20.0030.03316.42
5.4.10.0030.03316.42
5.4.00.0030.03315.90
5.3.290.0030.08014.68
5.3.280.0100.05014.66
5.3.270.0170.07014.68
5.3.260.0100.07714.61
5.3.250.0130.06714.82
5.3.240.0130.07314.61
5.3.230.0130.06714.64
5.3.220.0100.05714.63
5.3.210.0000.08714.61
5.3.200.0000.08014.59
5.3.190.0000.08314.43
5.3.180.0030.04314.59
5.3.170.0030.03714.56
5.3.160.0030.04014.52
5.3.150.0070.04014.55
5.3.140.0030.03714.62
5.3.130.0070.03314.61
5.3.120.0000.05014.40
5.3.110.0100.03014.58
5.3.100.0000.04013.88
5.3.90.0000.03713.96
5.3.80.0070.03014.00
5.3.70.0070.03313.91
5.3.60.0030.03314.04
5.3.50.0000.03713.98
5.3.40.0000.04013.97
5.3.30.0000.03713.97
5.3.20.0030.03313.76
5.3.10.0070.03013.54
5.3.00.0030.03313.69
5.2.170.0030.02711.20
5.2.160.0030.02711.01
5.2.150.0030.05711.20
5.2.140.0000.03011.25
5.2.130.0000.03011.18
5.2.120.0030.02711.16
5.2.110.0030.05011.03
5.2.100.0030.02711.01
5.2.90.0070.02310.98
5.2.80.0030.03311.11
5.2.70.0000.03311.14
5.2.60.0070.02311.11
5.2.50.0030.02710.93
5.2.40.0000.03011.06
5.2.30.0000.03310.99
5.2.20.0030.02711.18
5.2.10.0030.03010.91
5.2.00.0030.03010.63
5.1.60.0030.02010.22
5.1.50.0070.01710.00
5.1.40.0000.02310.06
5.1.30.0000.02710.55
5.1.20.0030.02310.32
5.1.10.0030.02310.13
5.1.00.0030.02310.07
5.0.50.0000.0208.39
5.0.40.0070.0178.42
5.0.30.0000.0478.23
5.0.20.0030.0478.14
5.0.10.0030.0308.03
5.0.00.0000.0578.14
4.4.90.0000.0177.90
4.4.80.0000.0177.90
4.4.70.0030.0137.90
4.4.60.0000.0177.90
4.4.50.0030.0177.90
4.4.40.0030.0207.90
4.4.30.0030.0177.90
4.4.20.0030.0137.90
4.4.10.0070.0107.90
4.4.00.0000.0237.90
4.3.110.0000.0177.90
4.3.100.0000.0177.90
4.3.90.0000.0177.90
4.3.80.0000.0577.90
4.3.70.0070.0137.90
4.3.60.0030.0137.90
4.3.50.0000.0177.90
4.3.40.0000.0277.90
4.3.30.0000.0377.90
4.3.20.0000.0377.90
4.3.10.0030.0337.90
4.3.00.0030.0337.90

preferences:
46.3 ms | 400 KiB | 5 Q