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/*"). 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.0040.01118.65
8.3.50.0090.00616.72
8.3.40.0070.01018.78
8.3.30.0130.00318.93
8.3.20.0000.00919.04
8.3.10.0030.00520.78
8.3.00.0030.00617.75
8.2.180.0070.01116.75
8.2.170.0120.00322.96
8.2.160.0030.01022.20
8.2.150.0080.00024.18
8.2.140.0000.00724.66
8.2.130.0050.00326.16
8.2.120.0070.00320.07
8.2.110.0000.01219.38
8.2.100.0090.00317.97
8.2.90.0040.00419.22
8.2.80.0030.00517.97
8.2.70.0040.00417.75
8.2.60.0000.00917.80
8.2.50.0040.00418.10
8.2.40.0060.00318.16
8.2.30.0050.00218.20
8.2.20.0030.00617.96
8.2.10.0000.00717.81
8.2.00.0040.00417.80
8.1.280.0110.00725.92
8.1.270.0050.00323.99
8.1.260.0070.00726.35
8.1.250.0050.00228.09
8.1.240.0000.01119.73
8.1.230.0110.00017.77
8.1.220.0030.00517.91
8.1.210.0090.00018.77
8.1.200.0000.01017.60
8.1.190.0000.01117.47
8.1.180.0060.00318.10
8.1.170.0000.00819.03
8.1.160.0040.00419.07
8.1.150.0080.00018.78
8.1.140.0030.00517.68
8.1.130.0050.00317.95
8.1.120.0040.00417.60
8.1.110.0000.00817.67
8.1.100.0040.00417.62
8.1.90.0000.00717.54
8.1.80.0040.00417.69
8.1.70.0030.00317.57
8.1.60.0040.00417.77
8.1.50.0080.00017.71
8.1.40.0040.00417.68
8.1.30.0000.00817.85
8.1.20.0050.00317.86
8.1.10.0050.00317.72
8.1.00.0030.00617.65
8.0.300.0030.00618.78
8.0.290.0040.00416.88
8.0.280.0040.00418.38
8.0.270.0000.00717.25
8.0.260.0070.00017.00
8.0.250.0090.00017.02
8.0.240.0030.00817.10
8.0.230.0050.00217.15
8.0.220.0030.00617.16
8.0.210.0000.00717.00
8.0.200.0040.00417.14
8.0.190.0000.00817.16
8.0.180.0070.00017.07
8.0.170.0070.00317.07
8.0.160.0030.00316.98
8.0.150.0040.00417.11
8.0.140.0040.00717.07
8.0.130.0030.00313.43
8.0.120.0040.00417.09
8.0.110.0080.00017.25
8.0.100.0000.00717.13
8.0.90.0000.00717.13
8.0.80.0060.00917.13
8.0.70.0040.00417.10
8.0.60.0060.00317.04
8.0.50.0030.00516.98
8.0.30.0070.01217.27
8.0.20.0120.00617.50
8.0.10.0040.00417.30
8.0.00.0120.01117.15
7.4.330.0000.00514.93
7.4.320.0060.00016.72
7.4.300.0030.00316.86
7.4.290.0070.00016.82
7.4.280.0000.00816.82
7.4.270.0030.00316.87
7.4.260.0050.00013.61
7.4.250.0040.00416.79
7.4.240.0040.00416.91
7.4.230.0000.00716.85
7.4.220.0080.01216.77
7.4.210.0080.00716.93
7.4.200.0000.00716.91
7.4.190.0000.00716.79
7.4.160.0060.01016.71
7.4.150.0070.01317.18
7.4.140.0140.01617.23
7.4.130.0060.01216.82
7.4.120.0110.00716.90
7.4.110.0110.00716.84
7.4.100.0120.00616.84
7.4.90.0070.01316.82
7.4.80.0040.01318.80
7.4.70.0140.01216.49
7.4.60.0130.00316.73
7.4.50.0050.00516.80
7.4.40.0060.00922.27
7.4.30.0110.00816.73
7.4.10.0060.01315.36
7.4.00.0100.00815.19
7.3.330.0060.00013.40
7.3.320.0000.00513.41
7.3.310.0000.00716.39
7.3.300.0030.00316.42
7.3.290.0070.01316.51
7.3.280.0050.01416.50
7.3.270.0090.00617.18
7.3.260.0110.00818.24
7.3.250.0110.00916.55
7.3.240.0040.01416.47
7.3.230.0100.01016.46
7.3.210.0140.00416.75
7.3.200.0040.01519.39
7.3.190.0060.01616.74
7.3.180.0090.00616.57
7.3.170.0140.00416.63
7.3.160.0100.00616.79
7.3.130.0060.00915.23
7.3.120.0080.01014.91
7.3.110.0100.00615.21
7.3.100.0040.01114.65
7.3.90.0000.00914.98
7.3.80.0030.01315.29
7.3.70.0030.01015.14
7.3.60.0100.00715.08
7.3.50.0030.01315.07
7.3.40.0060.00915.07
7.3.30.0060.00315.09
7.3.20.0030.01016.98
7.3.10.0060.00916.82
7.3.00.0000.00917.06
7.2.330.0160.00616.77
7.2.320.0080.00816.78
7.2.310.0060.01316.68
7.2.300.0030.01416.71
7.2.290.0100.00716.76
7.2.260.0060.01515.21
7.2.250.0080.01115.29
7.2.240.0070.00715.47
7.2.230.0060.00914.91
7.2.220.0090.00615.00
7.2.210.0000.01415.16
7.2.200.0060.00314.98
7.2.190.0090.00915.13
7.2.180.0090.00315.18
7.2.170.0100.00315.17
7.2.160.0000.01415.37
7.2.150.0090.00917.07
7.2.140.0100.00316.78
7.2.130.0110.00016.87
7.2.120.0050.00517.16
7.2.110.0100.00317.14
7.2.100.0060.00617.14
7.2.90.0030.01017.10
7.2.80.0060.00617.02
7.2.70.0060.00917.16
7.2.60.0100.00317.09
7.2.50.0000.01817.23
7.2.40.0060.00317.09
7.2.30.0030.01017.08
7.2.20.0030.01017.01
7.2.10.0000.01416.91
7.2.00.0060.00618.42
7.1.330.0030.01316.08
7.1.320.0120.00315.93
7.1.310.0030.00915.95
7.1.300.0030.01016.07
7.1.290.0090.00915.96
7.1.280.0090.00315.93
7.1.270.0110.00615.87
7.1.260.0100.00316.22
7.1.250.0000.01416.08
7.1.240.0070.00716.00
7.1.230.0100.00016.06
7.1.220.0030.00916.13
7.1.210.0000.01315.95
7.1.200.0090.00615.68
7.1.190.0000.01415.71
7.1.180.0040.01115.86
7.1.170.0140.00016.13
7.1.160.0030.00615.99
7.1.150.0030.00616.06
7.1.140.0070.00415.96
7.1.130.0000.01015.80
7.1.120.0070.00416.03
7.1.110.0030.01016.01
7.1.100.0070.00617.20
7.1.90.0000.01016.09
7.1.80.0000.00916.14
7.1.70.0070.00516.76
7.1.60.0060.00817.74
7.1.50.0000.01116.59
7.1.40.0070.01015.51
7.1.30.0060.01015.89
7.1.20.0000.01415.97
7.1.10.0060.01016.18
7.1.00.0030.04219.19
7.0.330.0080.00415.45
7.0.320.0030.01015.64
7.0.310.0030.01015.42
7.0.300.0080.00415.54
7.0.290.0000.01715.61
7.0.280.0040.01115.36
7.0.270.0000.01415.20
7.0.260.0060.00315.28
7.0.250.0030.01015.58
7.0.240.0060.00615.43
7.0.230.0080.00415.67
7.0.220.0060.00615.61
7.0.210.0050.00515.78
7.0.200.0030.00516.18
7.0.190.0040.00815.64
7.0.180.0060.00615.36
7.0.170.0030.00615.63
7.0.160.0060.00615.56
7.0.150.0110.00315.42
7.0.140.0030.04018.75
7.0.130.0060.00915.56
7.0.120.0030.00915.50
7.0.110.0140.04217.73
7.0.100.0290.04317.65
7.0.90.0120.02517.79
7.0.80.0250.04017.71
7.0.70.0140.04217.77
7.0.60.0210.03717.84
7.0.50.0200.02017.96
7.0.40.0050.04016.84
7.0.30.0030.04417.06
7.0.20.0090.03716.73
7.0.10.0070.02216.98
7.0.00.0090.04216.90
5.6.400.0090.00314.43
5.6.390.0060.00314.67
5.6.380.0070.00714.36
5.6.370.0030.01014.59
5.6.360.0050.00514.65
5.6.350.0070.01014.67
5.6.340.0040.01114.40
5.6.330.0000.01014.30
5.6.320.0030.01014.31
5.6.310.0100.00314.46
5.6.300.0050.00514.52
5.6.290.0030.01014.73
5.6.280.0060.03817.66
5.6.270.0060.00914.64
5.6.260.0060.01214.37
5.6.250.0050.02317.56
5.6.240.0070.04717.62
5.6.230.0100.01817.65
5.6.220.0060.04017.47
5.6.210.0040.04317.57
5.6.200.0100.04017.84
5.6.190.0110.01817.82
5.6.180.0060.04117.87
5.6.170.0000.02917.86
5.6.160.0070.02117.60
5.6.150.0070.04417.79
5.6.140.0080.04317.80
5.6.130.0140.01817.83
5.6.120.0050.05117.69
5.6.110.0050.03717.89
5.6.100.0050.04917.83
5.6.90.0110.03717.59
5.6.80.0080.03617.31
5.6.70.0050.02617.30
5.6.60.0100.02017.45
5.6.50.0050.02817.35
5.6.40.0080.04017.62
5.6.30.0100.04017.25
5.6.20.0080.02117.49
5.6.10.0030.03417.35
5.6.00.0060.03517.40
5.5.380.0090.02117.54
5.5.370.0060.04017.38
5.5.360.0050.02017.55
5.5.350.0080.03717.34
5.5.340.0060.02317.71
5.5.330.0020.02717.55
5.5.320.0030.04117.61
5.5.310.0040.03517.50
5.5.300.0020.05417.39
5.5.290.0050.03917.54
5.5.280.0020.05017.69
5.5.270.0060.02317.70
5.5.260.0070.03217.45
5.5.250.0060.02017.45
5.5.240.0020.03517.27
5.5.230.0090.02217.41
5.5.220.0060.02117.40
5.5.210.0030.04017.30
5.5.200.0090.03017.18
5.5.190.0050.02617.19
5.5.180.0050.03217.21
5.5.170.0080.00314.13
5.5.160.0050.02017.14
5.5.150.0050.02417.21
5.5.140.0050.03017.23
5.5.130.0080.03217.36
5.5.120.0030.02317.14
5.5.110.0030.04517.16
5.5.100.0030.04317.17
5.5.90.0050.02217.29
5.5.80.0050.03317.21
5.5.70.0030.02817.21
5.5.60.0080.04217.28
5.5.50.0020.03717.04
5.5.40.0070.02517.06
5.5.30.0020.02417.24
5.5.20.0120.02217.21
5.5.10.0070.01917.26
5.5.00.0050.02717.03
5.4.450.0030.04215.90
5.4.440.0030.04316.08
5.4.430.0060.02316.00
5.4.420.0020.02216.08
5.4.410.0070.02515.90
5.4.400.0110.01515.85
5.4.390.0040.03315.76
5.4.380.0100.03015.82
5.4.370.0030.02315.75
5.4.360.0030.02515.75
5.4.350.0020.02515.73
5.4.340.0060.03515.83
5.4.330.0090.00012.50
5.4.320.0080.03815.75
5.4.310.0050.02515.74
5.4.300.0050.03315.79
5.4.290.0060.02015.79
5.4.280.0020.02615.75
5.4.270.0050.03015.75
5.4.260.0020.02215.75
5.4.250.0060.03115.75
5.4.240.0050.03315.82
5.4.230.0000.03515.74
5.4.220.0070.02315.77
5.4.210.0060.03915.75
5.4.200.0030.02515.73
5.4.190.0050.03815.86
5.4.180.0020.02815.75
5.4.170.0070.03315.76
5.4.160.0020.02815.75
5.4.150.0020.02515.74
5.4.140.0030.04314.48
5.4.130.0020.02414.57
5.4.120.0060.03714.45
5.4.110.0060.02814.46
5.4.100.0020.02514.41
5.4.90.0050.02314.41
5.4.80.0030.03514.60
5.4.70.0030.03314.55
5.4.60.0070.03114.46
5.4.50.0050.04014.53
5.4.40.0060.03314.50
5.4.30.0060.03114.56
5.4.20.0020.02314.52
5.4.10.0050.04014.52
5.4.00.0050.01714.15
5.3.290.0060.03313.59
5.3.280.0070.01813.55
5.3.270.0070.02313.60
5.3.260.0040.03413.60
5.3.250.0070.02213.56
5.3.240.0050.04113.54
5.3.230.0070.02813.61
5.3.220.0030.02613.54
5.3.210.0020.03713.53
5.3.200.0050.02413.54
5.3.190.0050.02413.65
5.3.180.0050.03813.54
5.3.170.0050.03213.46
5.3.160.0080.03513.58
5.3.150.0030.03913.60
5.3.140.0060.03313.57
5.3.130.0090.01713.59
5.3.120.0030.02313.51
5.3.110.0130.02713.51
5.3.100.0080.02513.28
5.3.90.0070.04013.28
5.3.80.0050.03813.20
5.3.70.0080.03313.30
5.3.60.0060.02713.23
5.3.50.0020.04213.34
5.3.40.0050.04013.30
5.3.30.0030.03913.22
5.3.20.0020.02013.10
5.3.10.0020.03813.08
5.3.00.0080.03113.08
5.2.170.0070.06011.12
5.2.160.0030.06011.22
5.2.150.0100.06011.15
5.2.140.0070.02311.20
5.2.130.0030.06711.11
5.2.120.0070.02311.33
5.2.110.0070.05311.16
5.2.100.0070.05011.11
5.2.90.0000.06011.18
5.2.80.0000.03011.32
5.2.70.0070.03311.09
5.2.60.0030.02711.04
5.2.50.0000.03010.98
5.2.40.0130.05011.08
5.2.30.0100.03010.97
5.2.20.0030.02311.06
5.2.10.0000.04310.84
5.2.00.0000.03010.86
5.1.60.0030.0479.98
5.1.50.0070.0479.82
5.1.40.0070.0339.97
5.1.30.0100.02010.34
5.1.20.0000.04710.36
5.1.10.0030.05710.04
5.1.00.0070.02010.17
5.0.50.0030.0478.54
5.0.40.0070.0138.50
5.0.30.0100.0538.06
5.0.20.0000.0238.18
5.0.10.0000.0478.18
5.0.00.0030.0308.34
4.4.90.0030.0377.86
4.4.80.0070.0137.86
4.4.70.0000.0177.86
4.4.60.0070.0277.86
4.4.50.0000.0377.86
4.4.40.0030.0537.86
4.4.30.0030.0337.86
4.4.20.0030.0277.86
4.4.10.0030.0337.86
4.4.00.0000.0577.86
4.3.110.0070.0307.86
4.3.100.0000.0337.86
4.3.90.0030.0107.86
4.3.80.0030.0537.86
4.3.70.0070.0237.86
4.3.60.0000.0377.86
4.3.50.0000.0177.86
4.3.40.0000.0437.86
4.3.30.0000.0237.86
4.3.20.0000.0307.86
4.3.10.0030.0307.86
4.3.00.0030.0337.86

preferences:
46.34 ms | 401 KiB | 5 Q