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/*"). 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.0170.00716.75
8.3.50.0090.00817.70
8.3.40.0070.00719.00
8.3.30.0040.01118.82
8.3.20.0060.00319.05
8.3.10.0090.00020.70
8.3.00.0120.00619.50
8.2.180.0090.00616.63
8.2.170.0070.01522.96
8.2.160.0130.00719.46
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0080.00019.89
8.2.110.0070.00322.36
8.2.100.0040.00717.97
8.2.90.0000.00919.28
8.2.80.0060.00319.28
8.2.70.0030.00517.63
8.2.60.0040.00417.80
8.2.50.0080.00018.07
8.2.40.0040.00418.22
8.2.30.0060.00318.30
8.2.20.0040.00417.91
8.2.10.0040.00417.84
8.2.00.0080.00017.93
8.1.280.0070.00725.92
8.1.270.0040.00424.66
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0030.00623.88
8.1.230.0040.00721.03
8.1.220.0050.00317.74
8.1.210.0060.00319.04
8.1.200.0090.00017.60
8.1.190.0040.00417.78
8.1.180.0060.00318.10
8.1.170.0050.00318.88
8.1.160.0050.00218.93
8.1.150.0040.00418.80
8.1.140.0000.00817.70
8.1.130.0000.00717.80
8.1.120.0030.00517.49
8.1.110.0000.00717.60
8.1.100.0050.00317.64
8.1.90.0000.00717.61
8.1.80.0040.00417.53
8.1.70.0000.00717.63
8.1.60.0030.00617.64
8.1.50.0050.00317.70
8.1.40.0040.00417.72
8.1.30.0080.00017.72
8.1.20.0040.00417.68
8.1.10.0040.00417.62
8.1.00.0000.00817.70
8.0.300.0040.00420.16
8.0.290.0000.00716.88
8.0.280.0040.00418.50
8.0.270.0040.00417.25
8.0.260.0000.00717.00
8.0.250.0080.00017.11
8.0.240.0040.00417.11
8.0.230.0030.00317.02
8.0.220.0000.00817.17
8.0.210.0040.00417.14
8.0.200.0000.00617.10
8.0.190.0040.00417.11
8.0.180.0040.00417.11
8.0.170.0040.00716.97
8.0.160.0040.00417.12
8.0.150.0030.00616.87
8.0.140.0070.00617.03
8.0.130.0060.00013.50
8.0.120.0080.00016.99
8.0.110.0040.00417.13
8.0.100.0050.00317.18
8.0.90.0080.00016.96
8.0.80.0040.01117.14
8.0.70.0000.00917.10
8.0.60.0000.00817.20
8.0.50.0030.00517.15
8.0.30.0150.00917.35
8.0.20.0110.01117.30
8.0.10.0050.00317.24
8.0.00.0110.01117.10
7.4.330.0000.00513.18
7.4.320.0040.00416.96
7.4.300.0030.00316.89
7.4.290.0070.00016.93
7.4.280.0000.00816.72
7.4.270.0030.00516.76
7.4.260.0000.00613.59
7.4.250.0030.00516.88
7.4.240.0000.00816.96
7.4.230.0040.00416.98
7.4.220.0070.01316.94
7.4.210.0070.00816.88
7.4.200.0000.00717.02
7.4.190.0030.00316.75
7.4.160.0060.01216.59
7.4.150.0110.01316.84
7.4.140.0130.01116.63
7.4.130.0090.00816.80
7.4.120.0080.00816.63
7.4.110.0090.00916.63
7.4.100.0090.00916.77
7.4.90.0100.00716.61
7.4.80.0030.01619.39
7.4.70.0000.01716.77
7.4.60.0060.01016.80
7.4.50.0060.00616.75
7.4.40.0100.00716.80
7.4.30.0110.00616.60
7.4.00.0040.01115.02
7.3.330.0040.00413.32
7.3.320.0030.00313.46
7.3.310.0000.00816.39
7.3.300.0040.00416.56
7.3.290.0030.01016.52
7.3.280.0070.01116.48
7.3.270.0120.00616.63
7.3.260.0070.01316.55
7.3.250.0090.01016.54
7.3.240.0120.00916.55
7.3.230.0120.00616.55
7.3.210.0070.01416.89
7.3.200.0040.01216.52
7.3.190.0180.00616.55
7.3.180.0150.00016.75
7.3.170.0060.01216.88
7.3.160.0090.00616.48
7.3.120.0070.01115.08
7.3.110.0060.01015.35
7.3.100.0080.00615.24
7.3.90.0070.01015.01
7.3.80.0040.01115.23
7.3.70.0040.01015.09
7.3.60.0040.01215.07
7.3.50.0100.00715.08
7.3.40.0070.01014.66
7.3.30.0060.01214.86
7.3.20.0000.01416.93
7.3.10.0070.01016.95
7.3.00.0100.00716.87
7.2.330.0090.00916.84
7.2.320.0090.00916.70
7.2.310.0100.01416.86
7.2.300.0110.00716.84
7.2.290.0080.00916.99
7.2.240.0070.01015.08
7.2.230.0000.01115.28
7.2.220.0070.00715.02
7.2.210.0100.00315.46
7.2.200.0090.00915.23
7.2.190.0100.00315.24
7.2.180.0000.01815.21
7.2.170.0030.01415.34
7.2.160.0000.01615.34
7.2.150.0040.00817.18
7.2.140.0040.01117.05
7.2.130.0090.00616.84
7.2.120.0100.00317.06
7.2.110.0030.01217.23
7.2.100.0100.00717.08
7.2.90.0060.00617.34
7.2.80.0070.00717.10
7.2.70.0060.00917.10
7.2.60.0050.00517.07
7.2.50.0120.00417.19
7.2.40.0100.00317.16
7.2.30.0100.00317.20
7.2.20.0040.01117.22
7.2.10.0030.01617.06
7.2.00.0070.00818.35
7.1.330.0000.01115.82
7.1.320.0030.01015.94
7.1.310.0030.01415.79
7.1.300.0100.00715.94
7.1.290.0070.00716.08
7.1.280.0090.00316.02
7.1.270.0030.00816.12
7.1.260.0040.00715.95
7.1.250.0030.01415.95
7.1.200.0090.00616.00
7.1.100.0000.01018.01
7.1.70.0000.01117.48
7.1.60.0030.02019.40
7.1.50.0040.01817.29
7.1.00.0000.03722.48
7.0.200.0040.00715.16
7.0.140.0070.07022.15
7.0.120.0070.06322.18
7.0.60.0130.08019.96
7.0.50.0070.04017.92
7.0.40.0000.04720.07
7.0.30.0300.07320.14
7.0.20.0370.06720.35
7.0.10.0100.04720.32
7.0.00.0100.04320.26
5.6.280.0030.07320.77
5.6.210.0000.04320.72
5.6.200.0000.04318.19
5.6.190.0030.04320.77
5.6.180.0230.04320.61
5.6.170.0170.04020.46
5.6.160.0100.07320.48
5.6.150.0100.08018.16
5.6.140.0100.07718.19
5.6.130.0100.08018.21
5.6.120.0030.07720.90
5.6.110.0100.08020.99
5.6.100.0100.06320.96
5.6.90.0070.08321.01
5.6.80.0100.03720.41
5.6.70.0170.08320.38
5.5.350.0300.06720.44
5.5.340.0100.05018.02
5.5.330.0130.07320.57
5.5.320.0100.07320.57
5.5.310.0230.04720.35
5.5.300.0070.04717.99
5.5.290.0030.08017.95
5.5.280.0030.08020.69
5.5.270.0000.04320.96
5.5.260.0030.09320.65
5.5.250.0000.07720.59
5.5.240.0100.07020.27
5.4.450.0000.04319.48
5.4.440.0030.04719.45
5.4.430.0030.04019.32
5.4.420.0030.04019.48
5.4.410.0070.04019.20
5.4.400.0030.03718.98
5.4.390.0030.03719.17
5.4.380.0070.04019.00
5.4.370.0000.04019.24
5.4.360.0030.03719.20
5.4.350.0070.03718.94
5.4.340.0030.08018.85
5.4.320.0230.03019.14
5.4.310.0070.06319.12
5.4.300.0000.05719.20
5.4.290.0130.07019.14
5.4.280.0030.05319.07
5.4.270.0100.07318.85
5.4.260.0030.05319.14
5.4.250.0100.06719.19
5.4.240.0130.07019.14
5.4.230.0030.04718.97
5.4.220.0100.07319.14
5.4.210.0030.05019.24
5.4.200.0130.07319.23
5.4.190.0130.06318.84
5.4.180.0030.04318.91
5.4.170.0030.05019.23
5.4.160.0170.05019.22
5.4.150.0070.05018.83
5.4.140.0030.08016.40
5.4.130.0030.05016.41
5.4.120.0030.03716.35
5.4.110.0030.05716.47
5.4.100.0030.07716.45
5.4.90.0030.07016.49
5.4.80.0100.07016.45
5.4.70.0070.04316.42
5.4.60.0070.06716.43
5.4.50.0070.07016.31
5.4.40.0000.08016.31
5.4.30.0170.03716.64
5.4.20.0100.06016.36
5.4.10.0100.04316.44
5.4.00.0000.07715.85
5.3.290.0100.04314.70
5.3.280.0070.04014.76
5.3.270.0030.08014.66
5.3.260.0000.05714.60
5.3.250.0170.06714.65
5.3.240.0030.06314.63
5.3.230.0070.03714.49
5.3.220.0000.06714.56
5.3.210.0030.04714.73
5.3.200.0170.06314.60
5.3.190.0100.05714.60
5.3.180.0130.06714.57
5.3.170.0100.05714.62
5.3.160.0100.06714.56
5.3.150.0070.07314.72
5.3.140.0170.03314.57
5.3.130.0100.05714.55
5.3.120.0030.05014.59
5.3.110.0100.07014.62
5.3.100.0170.06014.00
5.3.90.0100.04014.09
5.3.80.0130.06314.03
5.3.70.0070.05713.98
5.3.60.0100.07314.00
5.3.50.0070.06714.02
5.3.40.0000.07713.87
5.3.30.0030.04713.91
5.3.20.0030.08013.62
5.3.10.0000.06013.66
5.3.00.0100.05713.59
5.2.170.0100.06011.16
5.2.160.0100.04711.09
5.2.150.0070.05011.14
5.2.140.0100.04711.21
5.2.130.0030.03711.07
5.2.120.0070.06011.16
5.2.110.0030.04311.26
5.2.100.0030.03311.07
5.2.90.0130.03711.00
5.2.80.0030.03011.10
5.2.70.0130.03011.15
5.2.60.0030.05310.97
5.2.50.0000.07011.17
5.2.40.0100.05711.07
5.2.30.0000.06710.99
5.2.20.0000.04311.02
5.2.10.0070.05310.86
5.2.00.0070.05710.68
5.1.60.0030.05310.09
5.1.50.0070.0339.97
5.1.40.0000.0279.89
5.1.30.0070.03710.26
5.1.20.0030.03010.51
5.1.10.0030.02710.05
5.1.00.0070.05310.12
5.0.50.0070.0308.61
5.0.40.0030.0338.49
5.0.30.0070.0578.30
5.0.20.0030.0308.26
5.0.10.0070.0408.25
5.0.00.0000.0708.13
4.4.90.0070.0377.88
4.4.80.0000.0337.88
4.4.70.0030.0307.88
4.4.60.0100.0177.88
4.4.50.0000.0237.88
4.4.40.0000.0577.88
4.4.30.0000.0207.88
4.4.20.0000.0177.88
4.4.10.0030.0337.88
4.4.00.0030.0377.88
4.3.110.0030.0207.88
4.3.100.0070.0307.88
4.3.90.0070.0337.88
4.3.80.0000.0407.88
4.3.70.0030.0207.88
4.3.60.0030.0207.88
4.3.50.0070.0277.88
4.3.40.0100.0207.88
4.3.30.0000.0277.88
4.3.20.0070.0177.88
4.3.10.0000.0207.88
4.3.00.0030.0177.88

preferences:
34.45 ms | 401 KiB | 5 Q