3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { if (preg_match('/(?:\/(?:home|default|index)\..{3,4}\*)/i',$url)) { echo 1; $url = preg_replace('/^(.*)(\/(?:home|default|index)\..{3,4}\*)(.*)$/i', "$1$2$3", $url); } else { echo 2; $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.0110.00716.75
8.3.50.0110.00817.42
8.3.40.0030.01218.93
8.3.30.0060.00918.79
8.3.20.0080.00818.74
8.3.10.0050.00320.67
8.3.00.0040.00419.34
8.2.180.0080.01116.88
8.2.170.0130.00922.96
8.2.160.0150.00021.32
8.2.150.0040.00424.18
8.2.140.0060.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00020.91
8.2.110.0040.00821.16
8.2.100.0090.00317.77
8.2.90.0030.00621.09
8.2.80.0040.00418.04
8.2.70.0000.00817.88
8.2.60.0030.00617.80
8.2.50.0080.00418.07
8.2.40.0090.00018.16
8.2.30.0040.00418.00
8.2.20.0070.00017.68
8.2.10.0030.00517.67
8.2.00.0040.00417.82
8.1.280.0150.00625.92
8.1.270.0080.00024.66
8.1.260.0060.00326.35
8.1.250.0050.00528.09
8.1.240.0060.00322.54
8.1.230.0000.01121.10
8.1.220.0040.00417.77
8.1.210.0030.00619.09
8.1.200.0060.00317.36
8.1.190.0080.00017.66
8.1.180.0040.00418.10
8.1.170.0030.00519.02
8.1.160.0040.00418.84
8.1.150.0060.00318.94
8.1.140.0080.00017.60
8.1.130.0000.00717.89
8.1.120.0000.00717.67
8.1.110.0050.00317.68
8.1.100.0070.00017.56
8.1.90.0040.00417.54
8.1.80.0000.00717.54
8.1.70.0000.00717.61
8.1.60.0060.00317.80
8.1.50.0030.00617.62
8.1.40.0090.00017.60
8.1.30.0040.00417.88
8.1.20.0030.00617.84
8.1.10.0040.00417.71
8.1.00.0000.00817.64
8.0.300.0040.00420.23
8.0.290.0000.00717.00
8.0.280.0030.00318.52
8.0.270.0050.00217.32
8.0.260.0030.00317.02
8.0.250.0080.00017.15
8.0.240.0040.00417.02
8.0.230.0000.00717.14
8.0.220.0050.00217.06
8.0.210.0000.00717.11
8.0.200.0030.00317.09
8.0.190.0000.00817.16
8.0.180.0030.00517.00
8.0.170.0030.00617.09
8.0.160.0050.00217.07
8.0.150.0090.00017.11
8.0.140.0030.00517.06
8.0.130.0060.00013.48
8.0.120.0040.00417.05
8.0.110.0050.00216.98
8.0.100.0040.00417.09
8.0.90.0000.00717.09
8.0.80.0120.00317.09
8.0.70.0050.00217.13
8.0.60.0000.00817.05
8.0.50.0080.00017.04
8.0.30.0030.01717.59
8.0.20.0080.01217.44
8.0.10.0070.00016.99
8.0.00.0070.01116.83
7.4.330.0020.00213.29
7.4.320.0030.00316.73
7.4.300.0000.00916.84
7.4.290.0030.00316.68
7.4.280.0060.00316.86
7.4.270.0040.00416.81
7.4.260.0050.00013.64
7.4.250.0080.00016.76
7.4.240.0050.00316.88
7.4.230.0000.00716.65
7.4.220.0080.01116.91
7.4.210.0080.00716.79
7.4.200.0000.00716.94
7.4.190.0080.00016.95
7.4.160.0160.00016.61
7.4.150.0120.00616.69
7.4.140.0080.01016.60
7.4.130.0090.00816.90
7.4.120.0160.00516.78
7.4.110.0060.01216.66
7.4.100.0130.01316.68
7.4.90.0100.00716.57
7.4.80.0120.01219.39
7.4.70.0060.01016.83
7.4.60.0120.00916.75
7.4.50.0090.00416.65
7.4.40.0070.01016.82
7.4.30.0090.00616.60
7.4.00.0150.00014.91
7.3.330.0060.00013.43
7.3.320.0030.00313.24
7.3.310.0030.00316.33
7.3.300.0000.00716.41
7.3.290.0110.00316.44
7.3.280.0060.01016.44
7.3.270.0070.01016.50
7.3.260.0100.00916.65
7.3.250.0100.00716.49
7.3.240.0150.00616.45
7.3.230.0030.01416.42
7.3.210.0070.01116.91
7.3.200.0130.01016.84
7.3.190.0060.01416.75
7.3.180.0130.00316.86
7.3.170.0060.01116.41
7.3.160.0110.00716.50
7.3.120.0110.00714.71
7.3.110.0090.00615.15
7.3.100.0030.01114.99
7.3.90.0080.00815.36
7.3.80.0040.01414.71
7.3.70.0030.01014.90
7.3.60.0030.01215.05
7.3.50.0100.00714.97
7.3.40.0000.01415.07
7.3.30.0110.00314.86
7.3.20.0030.01216.67
7.3.10.0060.01016.64
7.3.00.0030.01016.88
7.2.330.0090.01216.76
7.2.320.0220.00616.70
7.2.310.0070.01716.81
7.2.300.0140.00416.94
7.2.290.0090.00616.87
7.2.240.0040.01515.23
7.2.230.0090.00615.32
7.2.220.0100.00715.13
7.2.210.0110.00714.94
7.2.200.0030.01215.10
7.2.190.0070.01015.02
7.2.180.0070.00315.12
7.2.170.0090.00615.33
7.2.160.0000.01215.42
7.2.150.0090.00316.99
7.2.140.0130.00317.18
7.2.130.0080.00816.76
7.2.120.0040.00817.23
7.2.110.0070.01017.01
7.2.100.0130.00016.91
7.2.90.0070.01017.08
7.2.80.0090.00616.88
7.2.70.0000.01316.75
7.2.60.0070.00716.93
7.2.50.0120.00317.27
7.2.40.0080.00416.96
7.2.30.0110.00417.05
7.2.20.0070.01016.81
7.2.10.0060.00917.21
7.2.00.0060.01118.39
7.1.330.0060.00615.93
7.1.320.0060.00616.16
7.1.310.0000.01115.99
7.1.300.0060.00616.13
7.1.290.0030.01316.10
7.1.280.0070.00415.98
7.1.270.0060.00916.07
7.1.260.0070.01015.80
7.1.250.0090.00016.04
7.1.100.0070.00718.37
7.1.70.0060.00617.51
7.1.60.0100.01419.40
7.1.50.0220.00935.11
7.1.00.0100.04322.48
7.0.200.0710.00314.64
7.0.140.0030.07022.07
7.0.120.0030.07722.13
7.0.60.0130.06719.95
7.0.50.0100.06017.93
7.0.40.0100.05020.33
7.0.30.0100.06720.22
7.0.20.0270.08020.43
7.0.10.0200.06020.14
7.0.00.0170.04020.26
5.6.280.0000.08021.07
5.6.210.0000.08720.72
5.6.200.0130.06718.29
5.6.190.0100.04320.52
5.6.180.0230.04720.54
5.6.170.0200.04720.50
5.6.160.0270.07720.61
5.6.150.0230.05720.52
5.6.140.0130.05020.49
5.6.130.0230.04320.19
5.6.120.0200.07720.17
5.6.110.0230.07720.49
5.6.100.0230.05320.42
5.6.90.0270.06020.39
5.6.80.0170.05319.62
5.6.70.0170.05719.78
5.6.60.0270.06719.56
5.6.50.0230.08019.70
5.6.40.0370.05319.70
5.6.30.0270.04719.86
5.6.20.0270.06719.80
5.6.10.0270.07319.86
5.6.00.0170.04719.68
5.5.350.0000.04720.50
5.5.340.0000.07717.98
5.5.330.0170.03720.30
5.5.320.0100.05320.26
5.5.310.0170.05020.30
5.5.300.0130.04720.17
5.5.290.0370.05320.21
5.5.280.0270.08020.14
5.5.270.0230.04020.11
5.5.260.0130.06319.98
5.5.250.0330.06720.02
5.5.240.0170.08019.38
5.5.230.0130.04719.58
5.5.220.0170.04319.70
5.5.210.0230.05719.35
5.5.200.0330.06719.55
5.5.190.0270.04719.52
5.5.180.0330.06319.39
5.5.160.0230.08019.38
5.5.150.0200.05319.33
5.5.140.0200.07719.34
5.5.130.0270.06319.46
5.5.120.0270.07319.32
5.5.110.0400.04019.52
5.5.100.0200.05019.58
5.5.90.0230.07319.23
5.5.80.0470.05319.54
5.5.70.0200.04019.21
5.5.60.0200.07719.37
5.5.50.0270.07319.45
5.5.40.0200.08019.38
5.5.30.0100.04719.46
5.5.20.0230.07319.52
5.5.10.0230.06719.27
5.5.00.0230.08019.24
5.4.450.0230.06719.54
5.4.440.0400.03319.48
5.4.430.0230.05019.46
5.4.420.0270.05019.46
5.4.410.0230.04319.41
5.4.400.0230.05018.88
5.4.390.0270.07018.95
5.4.380.0200.03719.24
5.4.370.0230.05319.08
5.4.360.0300.07018.93
5.4.350.0270.06719.16
5.4.340.0200.08019.26
5.4.320.0230.07019.14
5.4.310.0270.07019.21
5.4.300.0230.04719.15
5.4.290.0300.05318.96
5.4.280.0300.06319.24
5.4.270.0230.07318.94
5.4.260.0200.07319.16
5.4.250.0230.07319.26
5.4.240.0330.05719.14
5.4.230.0170.07718.92
5.4.220.0130.05718.87
5.4.210.0200.03719.15
5.4.200.0200.05019.19
5.4.190.0330.06019.23
5.4.180.0230.07318.95
5.4.170.0230.07018.96
5.4.160.0230.06318.96
5.4.150.0300.05319.22
5.4.140.0170.07716.46
5.4.130.0270.05716.50
5.4.120.0170.07316.39
5.4.110.0130.04716.50
5.4.100.0130.06716.48
5.4.90.0270.05716.55
5.4.80.0230.04316.43
5.4.70.0300.06016.53
5.4.60.0330.05716.39
5.4.50.0470.04716.36
5.4.40.0200.05716.39
5.4.30.0270.05316.46
5.4.20.0230.03716.39
5.4.10.0200.07716.37
5.4.00.0200.04715.84
5.3.290.0270.08014.68
5.3.280.0170.04014.62
5.3.270.0230.07014.65
5.3.260.0270.03714.62
5.3.250.0300.06714.69
5.3.240.0200.06014.51
5.3.230.0200.05314.66
5.3.220.0200.04714.60
5.3.210.0200.07014.67
5.3.200.0170.07014.63
5.3.190.0230.05014.62
5.3.180.0270.06714.46
5.3.170.0300.06014.50
5.3.160.0300.06714.59
5.3.150.0200.07714.59
5.3.140.0200.03714.57
5.3.130.0200.07714.45
5.3.120.0130.07014.72
5.3.110.0200.05014.59
5.3.100.0200.04014.21
5.3.90.0230.04314.03
5.3.80.0270.02714.17
5.3.70.0230.03014.07
5.3.60.0330.06313.90
5.3.50.0230.06013.95
5.3.40.0270.06713.96
5.3.30.0200.07314.07
5.3.20.0300.05313.76
5.3.10.0370.03013.70
5.3.00.0200.05013.70
5.2.170.0200.06012.50
5.2.160.0230.05312.50
5.2.150.0200.06012.50
5.2.140.0270.06712.50
5.2.130.0170.05712.50
5.2.120.0230.05312.50
5.2.110.0170.04312.50
5.2.100.0270.05712.50
5.2.90.0200.05012.50
5.2.80.0230.04012.50
5.2.70.0200.05012.50
5.2.60.0130.06712.50
5.2.50.0230.06312.50
5.2.40.0170.05712.50
5.2.30.0130.03712.50
5.2.20.0070.03712.50
5.2.10.0170.06012.50
5.2.00.0170.05312.50
5.1.60.0100.05312.50
5.1.50.0170.04712.50
5.1.40.0170.05012.50
5.1.30.0130.04012.50
5.1.20.0130.04312.50
5.1.10.0130.04712.50
5.1.00.0170.05312.50
5.0.50.0130.03012.50
5.0.40.0100.04012.50
5.0.30.0100.04312.50
5.0.20.0070.04712.50
5.0.10.0130.02712.50
5.0.00.0130.04712.50
4.4.90.0170.02012.50
4.4.80.0100.01712.50
4.4.70.0100.02312.50
4.4.60.0100.01712.50
4.4.50.0070.02012.50
4.4.40.0070.05312.50
4.4.30.0170.02712.50
4.4.20.0100.02012.50
4.4.10.0130.02312.50
4.4.00.0100.03012.50
4.3.110.0130.02012.50
4.3.100.0130.03012.50
4.3.90.0070.03312.50
4.3.80.0100.03312.50
4.3.70.0100.02712.50
4.3.60.0070.03012.50
4.3.50.0070.02312.50
4.3.40.0200.02712.50
4.3.30.0100.01712.50
4.3.20.0030.01712.50
4.3.10.0070.03712.50
4.3.00.0030.02012.50

preferences:
50.72 ms | 401 KiB | 5 Q