3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { echo preg_match('/[\?#]/',$url); $isLastCharPattern = substr($url,-1) == "*"; if ($isLastCharPattern && preg_match('/[\?#]/',$url)) { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\?\/#\*]+.*)?$/i', "$1$2", $url); } elseif($isLastCharPattern) { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\?\/#\*]+.*)*$/i', "$1$2", $url); } else { $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?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/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.0060.00916.63
8.3.50.0120.00617.60
8.3.40.0150.00018.70
8.3.30.0090.00619.02
8.3.20.0040.00418.73
8.3.10.0080.00020.43
8.3.00.0140.00719.50
8.2.180.0160.00017.00
8.2.170.0070.00722.96
8.2.160.0110.00420.52
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0040.00419.49
8.2.110.0090.00019.38
8.2.100.0000.01118.16
8.2.90.0100.00019.28
8.2.80.0040.00419.40
8.2.70.0080.00017.75
8.2.60.0030.00617.80
8.2.50.0040.00418.07
8.2.40.0040.00418.03
8.2.30.0000.00818.23
8.2.20.0000.00817.89
8.2.10.0040.00417.94
8.2.00.0040.00417.98
8.1.280.0070.01125.92
8.1.270.0030.00524.66
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0000.01023.78
8.1.230.0120.00021.11
8.1.220.0050.00317.89
8.1.210.0030.00619.03
8.1.200.0060.00317.61
8.1.190.0040.00417.64
8.1.180.0050.00318.10
8.1.170.0080.00018.91
8.1.160.0040.00419.11
8.1.150.0000.00818.99
8.1.140.0040.00417.76
8.1.130.0030.00317.85
8.1.120.0040.00417.56
8.1.110.0040.00317.65
8.1.100.0040.00417.66
8.1.90.0050.00317.60
8.1.80.0000.00717.60
8.1.70.0000.00717.56
8.1.60.0030.00617.77
8.1.50.0040.00417.70
8.1.40.0060.00317.72
8.1.30.0080.00017.85
8.1.20.0080.00017.73
8.1.10.0040.00417.59
8.1.00.0000.00917.63
8.0.300.0000.00920.00
8.0.290.0040.00416.88
8.0.280.0000.00718.48
8.0.270.0000.00717.23
8.0.260.0030.00617.00
8.0.250.0000.00817.09
8.0.240.0040.00417.06
8.0.230.0000.00817.17
8.0.220.0030.00317.04
8.0.210.0040.00417.07
8.0.200.0000.00717.12
8.0.190.0000.00817.13
8.0.180.0000.00816.93
8.0.170.0060.00317.06
8.0.160.0000.00717.13
8.0.150.0030.00717.01
8.0.140.0060.00617.05
8.0.130.0030.00313.59
8.0.120.0070.00017.10
8.0.110.0050.00217.03
8.0.100.0000.00817.01
8.0.90.0040.00417.13
8.0.80.0100.00717.02
8.0.70.0030.00517.18
8.0.60.0040.00417.01
8.0.50.0050.00317.16
8.0.30.0150.01317.16
8.0.20.0210.01717.40
8.0.10.0000.00817.20
8.0.00.0120.00817.14
7.4.330.0020.00213.20
7.4.320.0030.00316.92
7.4.300.0000.00616.79
7.4.290.0040.00416.89
7.4.280.0000.00816.89
7.4.270.0040.00416.96
7.4.260.0000.00513.55
7.4.250.0040.00416.80
7.4.240.0000.00716.85
7.4.230.0030.00316.72
7.4.220.0100.01016.94
7.4.210.0080.00916.91
7.4.200.0080.00016.90
7.4.190.0040.00416.91
7.4.160.0120.00416.76
7.4.150.0140.00416.63
7.4.140.0110.01116.84
7.4.130.0030.01516.71
7.4.120.0090.00816.76
7.4.110.0120.00416.72
7.4.100.0090.00916.59
7.4.90.0060.01216.81
7.4.80.0060.01216.77
7.4.70.0120.00416.78
7.4.60.0130.00316.66
7.4.50.0000.01316.70
7.4.40.0070.01016.88
7.4.30.0030.01316.63
7.4.00.0040.01015.25
7.3.330.0000.00613.48
7.3.320.0070.00013.50
7.3.310.0030.00316.29
7.3.300.0050.00216.50
7.3.290.0030.01516.46
7.3.280.0080.01016.48
7.3.270.0100.00716.71
7.3.260.0090.00916.48
7.3.250.0120.00916.80
7.3.240.0140.00316.67
7.3.230.0060.01116.48
7.3.210.0080.01216.50
7.3.200.0120.00619.39
7.3.190.0070.01416.80
7.3.180.0120.00316.82
7.3.170.0030.01516.86
7.3.160.0110.00516.61
7.3.120.0070.00814.95
7.3.110.0070.01014.95
7.3.100.0040.01114.80
7.3.90.0060.00914.84
7.3.80.0060.00614.84
7.3.70.0060.00614.76
7.3.60.0030.00615.12
7.3.50.0040.01114.67
7.3.40.0030.00715.16
7.3.30.0000.01414.96
7.3.20.0060.00316.66
7.3.10.0030.01416.82
7.3.00.0050.00516.77
7.2.330.0060.01516.91
7.2.320.0060.01216.73
7.2.310.0170.00316.91
7.2.300.0060.01016.70
7.2.290.0060.01516.80
7.2.250.0120.00615.44
7.2.240.0070.01415.42
7.2.230.0030.01315.02
7.2.220.0030.00615.46
7.2.210.0130.00315.26
7.2.200.0100.00315.32
7.2.190.0060.01015.29
7.2.180.0060.00914.96
7.2.170.0070.00315.31
7.2.00.0040.01119.49
7.1.330.0080.00815.88
7.1.320.0060.00316.15
7.1.310.0030.01315.86
7.1.300.0070.00715.85
7.1.290.0000.01415.73
7.1.280.0040.00415.93
7.1.270.0090.00316.05
7.1.260.0150.00015.72
7.1.200.0030.01016.18
7.1.100.0000.01218.64
7.1.70.0000.01017.45
7.1.60.0090.01519.40
7.1.50.0070.01417.18
7.1.00.0030.03322.37
7.0.200.0130.00314.94
7.0.140.0070.07022.08
7.0.120.0070.04022.18
7.0.60.0070.05719.89
7.0.50.0130.07717.93
7.0.40.0070.05720.43
7.0.30.0270.05320.36
7.0.20.0200.08720.12
7.0.10.0130.06020.18
7.0.00.0070.03720.09
5.6.280.0070.07020.89
5.6.210.0230.06320.75
5.6.200.0170.05718.16
5.6.190.0100.08020.35
5.6.180.0370.04020.65
5.6.170.0230.03720.62
5.6.160.0030.06320.43
5.6.150.0070.07318.15
5.6.140.0100.06318.28
5.6.130.0030.04018.13
5.6.120.0070.08321.04
5.6.110.0130.07721.20
5.6.100.0070.08020.99
5.6.90.0170.04720.94
5.6.80.0070.03720.41
5.5.350.0070.08020.46
5.5.340.0030.07017.99
5.5.330.0170.07020.40
5.5.320.0100.07020.24
5.5.310.0430.06720.38
5.5.300.0100.07717.98
5.5.290.0030.04718.04
5.5.280.0070.08020.74
5.5.270.0030.05720.87
5.5.260.0030.05020.98
5.5.250.0130.08320.70
5.5.240.0030.08020.29
5.4.450.0170.05719.57
5.4.440.0070.08719.49
5.4.430.0170.05319.47
5.4.420.0100.07319.43
5.4.410.0130.07019.04
5.4.400.0070.08018.98
5.4.390.0030.06719.00
5.4.380.0100.05319.24
5.4.370.0130.03719.25
5.4.360.0030.04718.84
5.4.350.0100.06319.16
5.4.340.0130.05318.85
5.4.320.0100.05719.15
5.4.310.0130.05019.12
5.4.300.0070.07018.85
5.4.290.0070.06319.15
5.4.280.0070.06719.15
5.4.270.0030.07019.09
5.4.260.0070.07319.11
5.4.250.0100.06719.14
5.4.240.0030.04019.13
5.4.230.0070.04319.07
5.4.220.0070.04019.14
5.4.210.0130.07319.14
5.4.200.0070.05319.07
5.4.190.0100.06319.23
5.4.180.0100.06719.14
5.4.170.0070.04718.99
5.4.160.0030.05318.86
5.4.150.0030.07018.84
5.4.140.0100.05316.50
5.4.130.0030.07716.39
5.4.120.0000.04016.38
5.4.110.0070.05016.29
5.4.100.0070.05016.54
5.4.90.0230.02016.50
5.4.80.0070.03316.44
5.4.70.0100.03016.46
5.4.60.0030.04316.41
5.4.50.0030.06716.64
5.4.40.0100.07016.27
5.4.30.0070.05716.38
5.4.20.0100.04316.31
5.4.10.0030.07716.50
5.4.00.0000.07315.79
5.3.290.0100.03714.67
5.3.280.0100.03714.64
5.3.270.0100.07714.61
5.3.260.0100.06714.76
5.3.250.0000.05014.65
5.3.240.0030.04014.61
5.3.230.0070.05014.61
5.3.220.0070.03714.57
5.3.210.0070.04314.56
5.3.200.0070.03714.71
5.3.190.0000.08014.57
5.3.180.0000.06014.71
5.3.170.0030.03714.61
5.3.160.0070.05014.59
5.3.150.0070.05314.48
5.3.140.0100.04314.61
5.3.130.0170.07014.43
5.3.120.0100.07314.44
5.3.110.0100.07714.43
5.3.100.0000.08014.04
5.3.90.0100.05313.94
5.3.80.0070.06714.07
5.3.70.0070.04014.07
5.3.60.0030.07713.95
5.3.50.0130.03014.01
5.3.40.0070.05313.84
5.3.30.0030.05713.96
5.3.20.0070.07713.84
5.3.10.0070.07013.65
5.3.00.0130.04313.59
5.2.170.0030.04311.14
5.2.160.0070.06311.18
5.2.150.0070.05011.31
5.2.140.0030.06711.18
5.2.130.0070.05311.07
5.2.120.0070.06311.26
5.2.110.0030.05011.25
5.2.100.0100.06011.05
5.2.90.0130.05711.10
5.2.80.0070.06010.99
5.2.70.0030.05011.15
5.2.60.0070.04011.11
5.2.50.0000.04311.01
5.2.40.0070.05711.15
5.2.30.0070.03710.97
5.2.20.0030.06310.88
5.2.10.0070.03310.93
5.2.00.0100.04010.64
5.1.60.0070.04310.17
5.1.50.0100.0439.96
5.1.40.0070.0509.95
5.1.30.0130.04710.38
5.1.20.0100.05710.31
5.1.10.0030.04010.21
5.1.00.0070.05310.11
5.0.50.0030.0478.53
5.0.40.0030.0408.58
5.0.30.0100.0578.21
5.0.20.0030.0438.27
5.0.10.0030.0238.27
5.0.00.0070.0278.19
4.4.90.0030.0337.88
4.4.80.0000.0237.88
4.4.70.0030.0337.88
4.4.60.0030.0337.88
4.4.50.0000.0277.88
4.4.40.0070.0507.88
4.4.30.0070.0207.88
4.4.20.0000.0377.88
4.4.10.0100.0277.88
4.4.00.0030.0577.88
4.3.110.0000.0337.88
4.3.100.0030.0337.88
4.3.90.0030.0207.88
4.3.80.0000.0277.88
4.3.70.0030.0207.88
4.3.60.0030.0377.88
4.3.50.0070.0207.88
4.3.40.0070.0307.88
4.3.30.0000.0407.88
4.3.20.0000.0377.88
4.3.10.0000.0307.88
4.3.00.0000.0277.88

preferences:
42.69 ms | 404 KiB | 6 Q