3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { echo preg_match('/[\?#]/',$url); if (substr($url, -1) == "*" && preg_match('/[\?#]/',$url)) { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\/\*]+)?$/i', "$1(?:$|((?:\/(?:home|default|index)\..{3,4})|\/?[\?#]+.*))$2", $url); } else { $url = preg_replace('/^(.*)(?:\/(?:home|default|index)\..{3,4})([\?\/#]+.*)*$/i', "$1(?:$|((?:\/(?:home|default|index)\..{3,4})|\/?[\?#]))$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.0100.00318.56
8.3.50.0140.00616.86
8.3.40.0080.00818.96
8.3.30.0190.00318.92
8.3.20.0060.00318.86
8.3.10.0040.00420.61
8.3.00.0060.00317.63
8.2.180.0070.01116.75
8.2.170.0070.00722.96
8.2.160.0140.00719.01
8.2.150.0000.00824.18
8.2.140.0110.00724.66
8.2.130.0030.00626.16
8.2.120.0050.00319.73
8.2.110.0060.00321.22
8.2.100.0070.00718.03
8.2.90.0000.00819.20
8.2.80.0050.00317.97
8.2.70.0000.00817.88
8.2.60.0030.00518.05
8.2.50.0000.00818.07
8.2.40.0050.00218.16
8.2.30.0050.00518.08
8.2.20.0050.00317.84
8.2.10.0040.00417.94
8.2.00.0060.00317.86
8.1.280.0090.01225.92
8.1.270.0050.00223.99
8.1.260.0080.00026.35
8.1.250.0000.00828.09
8.1.240.0030.00622.53
8.1.230.0000.01121.02
8.1.220.0040.00718.77
8.1.210.0040.00419.02
8.1.200.0030.00717.60
8.1.190.0000.00817.76
8.1.180.0030.00618.10
8.1.170.0090.00018.83
8.1.160.0040.00418.95
8.1.150.0020.00518.88
8.1.140.0030.00517.62
8.1.130.0030.00317.96
8.1.120.0070.00017.56
8.1.110.0060.00317.55
8.1.100.0050.00317.58
8.1.90.0070.00017.65
8.1.80.0050.00317.57
8.1.70.0040.00417.61
8.1.60.0090.00317.79
8.1.50.0040.00417.70
8.1.40.0080.00017.68
8.1.30.0060.00317.88
8.1.20.0000.00817.89
8.1.10.0000.00917.75
8.1.00.0030.00617.66
8.0.300.0050.00520.16
8.0.290.0040.00416.88
8.0.280.0030.00318.39
8.0.270.0070.00017.24
8.0.260.0000.00818.77
8.0.250.0040.00417.11
8.0.240.0060.00317.11
8.0.230.0080.00017.13
8.0.220.0000.00717.19
8.0.210.0000.00816.98
8.0.200.0030.00317.14
8.0.190.0070.00017.05
8.0.180.0050.00216.93
8.0.170.0030.00617.02
8.0.160.0070.00017.12
8.0.150.0040.00416.95
8.0.140.0080.00417.00
8.0.130.0060.00013.53
8.0.120.0040.00417.14
8.0.110.0000.00817.13
8.0.100.0040.00417.18
8.0.90.0020.00516.98
8.0.80.0080.00817.04
8.0.70.0000.00817.11
8.0.60.0000.00717.04
8.0.50.0030.00517.21
8.0.30.0140.00617.33
8.0.20.0100.01117.41
8.0.10.0040.00417.39
8.0.00.0110.01216.87
7.4.330.0030.00315.03
7.4.320.0030.00316.82
7.4.300.0070.00016.88
7.4.290.0040.00416.80
7.4.280.0040.00416.75
7.4.270.0040.00416.82
7.4.260.0030.00313.65
7.4.250.0000.00716.95
7.4.240.0030.00616.80
7.4.230.0080.00016.90
7.4.220.0080.01216.95
7.4.210.0070.00816.90
7.4.200.0000.00716.80
7.4.190.0030.00316.90
7.4.160.0100.00716.77
7.4.150.0140.00317.18
7.4.140.0080.01017.29
7.4.130.0110.00916.88
7.4.120.0060.01116.70
7.4.110.0060.01216.85
7.4.100.0110.00716.70
7.4.90.0120.01216.82
7.4.80.0160.00418.80
7.4.70.0060.01116.80
7.4.60.0030.01616.78
7.4.50.0040.00416.67
7.4.40.0060.00622.27
7.4.30.0080.00816.69
7.4.00.0090.00915.08
7.3.330.0040.00313.23
7.3.320.0060.00213.39
7.3.310.0070.00016.42
7.3.300.0000.00716.31
7.3.290.0070.00716.38
7.3.280.0080.00916.41
7.3.270.0090.00917.18
7.3.260.0140.00618.24
7.3.250.0120.00916.60
7.3.240.0090.00916.50
7.3.230.0040.01416.59
7.3.210.0090.00916.84
7.3.200.0070.01019.39
7.3.190.0090.01216.89
7.3.180.0080.00816.54
7.3.170.0060.01316.70
7.3.160.0000.01516.52
7.3.120.0060.00814.81
7.3.110.0090.00315.14
7.3.100.0130.00315.12
7.3.90.0040.01915.30
7.3.80.0040.01114.82
7.3.70.0000.00914.97
7.3.60.0070.01015.09
7.3.50.0000.01214.98
7.3.40.0040.00814.89
7.3.30.0110.00415.06
7.3.20.0000.01416.54
7.3.10.0060.01116.83
7.3.00.0060.00616.67
7.2.330.0110.00916.93
7.2.320.0150.00316.81
7.2.310.0100.01016.85
7.2.300.0080.01116.89
7.2.290.0080.00816.98
7.2.250.0030.01615.07
7.2.240.0070.01115.21
7.2.230.0060.00615.30
7.2.220.0060.00615.04
7.2.210.0040.01115.20
7.2.200.0030.01514.88
7.2.190.0100.00314.93
7.2.180.0110.00314.91
7.2.170.0030.01315.11
7.2.130.0000.00917.14
7.2.120.0030.01016.75
7.2.110.0160.01016.91
7.2.100.0000.01317.03
7.2.90.0100.00717.23
7.2.80.0090.00917.11
7.2.70.0090.00617.18
7.2.60.0080.00617.23
7.2.50.0070.00717.15
7.2.40.0110.00417.12
7.2.30.0100.00317.22
7.2.20.0060.00617.24
7.2.10.0080.00416.98
7.2.00.0050.00818.46
7.1.330.0100.00315.73
7.1.320.0090.00915.84
7.1.310.0050.00515.46
7.1.300.0100.00315.87
7.1.290.0030.00715.72
7.1.280.0000.01415.86
7.1.270.0060.00615.83
7.1.260.0120.00615.75
7.1.250.0000.00816.01
7.1.200.0030.00715.76
7.1.100.0060.00917.92
7.1.70.0000.00717.36
7.1.60.0070.01119.40
7.1.50.0120.00917.06
7.1.00.0070.04322.39
7.0.200.0030.00716.84
7.0.140.0030.07721.93
7.0.60.0030.06320.04
7.0.50.0070.06317.91
7.0.40.0100.08017.75
7.0.30.0030.07017.82
7.0.20.0070.07017.70
7.0.10.0070.04017.82
7.0.00.0030.05017.75
5.6.280.0070.07021.12
5.6.210.0030.07720.70
5.6.200.0170.06718.16
5.6.190.0030.07718.23
5.6.180.0070.07718.30
5.6.170.0100.08018.19
5.6.160.0070.04018.13
5.6.150.0030.09018.19
5.6.140.0030.04018.18
5.6.130.0030.07018.29
5.6.120.0030.04718.12
5.6.110.0030.07318.24
5.6.100.0130.08018.20
5.6.90.0100.05018.17
5.6.80.0130.07317.54
5.6.70.0070.05017.56
5.6.60.0100.07017.55
5.6.50.0030.05717.57
5.6.40.0030.05017.64
5.6.30.0130.04317.54
5.6.20.0000.04717.47
5.6.10.0000.04317.59
5.6.00.0130.04017.59
5.5.350.2670.03720.38
5.5.340.0130.07718.03
5.5.330.0030.09018.00
5.5.320.0000.09018.04
5.5.310.0070.07717.94
5.5.300.0030.08318.04
5.5.290.0130.08017.98
5.5.280.0130.07718.00
5.5.270.0000.05718.07
5.5.260.0070.08317.98
5.5.250.0030.06017.80
5.5.240.0170.06717.45
5.5.230.0070.05017.34
5.5.220.0070.07717.31
5.5.210.0100.06717.35
5.5.200.0030.06017.38
5.5.190.0030.08317.30
5.5.180.0030.06317.39
5.5.160.0030.04717.49
5.5.150.0100.04317.30
5.5.140.0070.05017.43
5.5.130.0070.05317.43
5.5.120.0000.08317.40
5.5.110.0070.05317.43
5.5.100.0130.07317.23
5.5.90.0030.04317.19
5.5.80.0100.05317.20
5.5.70.0130.05317.24
5.5.60.0130.05017.32
5.5.50.0100.07017.22
5.5.40.0030.05017.21
5.5.30.0030.07717.22
5.5.20.0030.07717.21
5.5.10.0130.07317.17
5.5.00.0130.04317.21
5.4.450.0100.05319.35
5.4.440.0100.08019.45
5.4.430.0030.04019.44
5.4.420.0070.07719.38
5.4.410.0170.06719.25
5.4.400.0100.07718.90
5.4.390.0100.04019.27
5.4.380.0000.06719.04
5.4.370.0070.05319.03
5.4.360.0030.06019.04
5.4.350.0030.04019.13
5.4.340.0000.05319.09
5.4.320.0030.04018.98
5.4.310.0000.04319.01
5.4.300.0100.07319.05
5.4.290.0070.04319.02
5.4.280.0070.07719.05
5.4.270.0000.06019.05
5.4.260.0070.06318.97
5.4.250.0030.07019.12
5.4.240.0030.05719.03
5.4.230.0070.07319.26
5.4.220.0000.08719.13
5.4.210.0100.07319.02
5.4.200.0100.05019.00
5.4.190.0130.06718.89
5.4.180.0030.07019.11
5.4.170.0000.07318.94
5.4.160.0030.05019.10
5.4.150.0100.06719.12
5.4.140.0130.07016.44
5.4.130.0030.04316.48
5.4.120.0070.04716.34
5.4.110.0070.03316.64
5.4.100.0030.07016.48
5.4.90.0070.07316.37
5.4.80.0030.05016.49
5.4.70.0030.04016.44
5.4.60.0030.04016.41
5.4.50.0030.04716.21
5.4.40.0070.03316.48
5.4.30.0070.06316.56
5.4.20.0130.06716.20
5.4.10.0070.04316.29
5.4.00.0100.06315.98
5.3.290.0000.06014.67
5.3.280.0100.06014.63
5.3.270.0070.04714.60
5.3.260.0000.08014.62
5.3.250.0070.05014.68
5.3.240.0100.03714.61
5.3.230.0070.06314.58
5.3.220.0030.05714.57
5.3.210.0000.04314.55
5.3.200.0100.03314.60
5.3.190.0070.07014.59
5.3.180.0030.05714.78
5.3.170.0000.06314.52
5.3.160.0100.04314.56
5.3.150.0000.05014.63
5.3.140.0130.03714.52
5.3.130.0000.08014.63
5.3.120.0030.08314.76
5.3.110.0100.07714.52
5.3.100.0100.07314.08
5.3.90.0030.05314.07
5.3.80.0100.06714.05
5.3.70.0100.05014.00
5.3.60.0070.07313.84
5.3.50.0030.05714.01
5.3.40.0000.08714.04
5.3.30.0100.06313.94
5.3.20.0000.06313.70
5.3.10.0100.03013.54
5.3.00.0130.06013.63
5.2.170.0000.04011.18
5.2.160.0030.06311.17
5.2.150.0030.04011.15
5.2.140.0030.03011.18
5.2.130.0030.02711.06
5.2.120.0030.03011.09
5.2.110.0030.02711.17
5.2.100.0070.06011.20
5.2.90.0070.06011.15
5.2.80.0100.06310.94
5.2.70.0030.07011.07
5.2.60.0030.06011.15
5.2.50.0070.06311.00
5.2.40.0030.06310.91
5.2.30.0030.06011.02
5.2.20.0000.06010.83
5.2.10.0000.06710.92
5.2.00.0000.06310.79
5.1.60.0070.05310.01
5.1.50.0030.0479.98
5.1.40.0030.0309.91
5.1.30.0030.05710.37
5.1.20.0030.04310.39
5.1.10.0030.03010.16
5.1.00.0030.02710.00
5.0.50.0100.0408.61
5.0.40.0030.0438.34
5.0.30.0000.0478.27
5.0.20.0070.0308.29
5.0.10.0070.0338.16
5.0.00.0030.0608.01
4.4.90.0030.0337.97
4.4.80.0000.0337.97
4.4.70.0000.0337.97
4.4.60.0000.0377.97
4.4.50.0000.0237.97
4.4.40.0000.0577.97
4.4.30.0000.0207.97
4.4.20.0030.0307.97
4.4.10.0000.0177.97
4.4.00.0070.0537.97
4.3.110.0030.0337.97
4.3.100.0030.0307.97
4.3.90.0000.0377.97
4.3.80.0000.0507.97
4.3.70.0030.0337.97
4.3.60.0000.0377.97
4.3.50.0070.0237.97
4.3.40.0000.0507.97
4.3.30.0030.0277.97
4.3.20.0070.0207.97
4.3.10.0030.0407.97
4.3.00.0000.0237.97

preferences:
34.52 ms | 401 KiB | 5 Q