3v4l.org

run code in 300+ PHP versions simultaneously
<?php function remove_index_etc($url) { $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.0100.01018.68
8.3.50.0100.01216.90
8.3.40.0060.00918.93
8.3.30.0160.00718.80
8.3.20.0040.01118.81
8.3.10.0120.00320.56
8.3.00.0080.00017.88
8.2.180.0100.00716.59
8.2.170.0040.01122.96
8.2.160.0130.00722.21
8.2.150.0040.00424.18
8.2.140.0130.00724.66
8.2.130.0060.00926.16
8.2.120.0000.00720.08
8.2.110.0030.00722.36
8.2.100.0090.00317.91
8.2.90.0040.00419.08
8.2.80.0000.00817.97
8.2.70.0030.00617.75
8.2.60.0070.00417.80
8.2.50.0050.00318.07
8.2.40.0000.00818.28
8.2.30.0060.00318.01
8.2.20.0040.00417.79
8.2.10.0040.00417.88
8.2.00.0030.00617.68
8.1.280.0110.00325.92
8.1.270.0050.00323.99
8.1.260.0120.00326.35
8.1.250.0070.00728.09
8.1.240.0100.00023.86
8.1.230.0080.00420.77
8.1.220.0000.00817.74
8.1.210.0030.00518.77
8.1.200.0090.00017.38
8.1.190.0000.00717.66
8.1.180.0000.00818.10
8.1.170.0000.00818.99
8.1.160.0000.00818.87
8.1.150.0050.00318.70
8.1.140.0030.00517.64
8.1.130.0000.00717.94
8.1.120.0030.00317.61
8.1.110.0040.00417.67
8.1.100.0080.00017.66
8.1.90.0040.00417.67
8.1.80.0000.00817.68
8.1.70.0040.00417.64
8.1.60.0040.00717.76
8.1.50.0050.00217.57
8.1.40.0000.00817.78
8.1.30.0040.00417.92
8.1.20.0030.00617.68
8.1.10.0040.00417.72
8.1.00.0030.00617.53
8.0.300.0000.00818.77
8.0.290.0000.00817.00
8.0.280.0050.00218.55
8.0.270.0040.00417.21
8.0.260.0060.00018.51
8.0.250.0000.00817.16
8.0.240.0090.00017.16
8.0.230.0000.00717.10
8.0.220.0000.00817.07
8.0.210.0000.00717.14
8.0.200.0030.00517.00
8.0.190.0070.00017.12
8.0.180.0040.00417.00
8.0.170.0060.00317.04
8.0.160.0040.00417.13
8.0.150.0060.00317.01
8.0.140.0060.00617.02
8.0.130.0030.00313.55
8.0.120.0040.00417.04
8.0.110.0000.00817.05
8.0.100.0040.00416.94
8.0.90.0000.00717.12
8.0.80.0030.01117.08
8.0.70.0030.00516.98
8.0.60.0060.00317.00
8.0.50.0000.00717.05
8.0.30.0080.01117.07
8.0.20.0100.01017.34
8.0.10.0080.00017.09
8.0.00.0050.01517.04
7.4.330.0000.00614.89
7.4.320.0060.00016.59
7.4.300.0000.00616.88
7.4.290.0030.00516.77
7.4.280.0080.00016.63
7.4.270.0000.00716.88
7.4.260.0000.00713.45
7.4.250.0000.00816.77
7.4.240.0040.00416.91
7.4.230.0070.00016.75
7.4.220.0130.01016.66
7.4.210.0070.00916.83
7.4.200.0030.00316.75
7.4.190.0000.00716.90
7.4.160.0040.01216.88
7.4.150.0150.00417.18
7.4.140.0090.00917.18
7.4.130.0130.00816.65
7.4.120.0140.00316.71
7.4.110.0090.01216.61
7.4.100.0130.00616.74
7.4.90.0110.00516.68
7.4.80.0100.00718.80
7.4.70.0110.00816.81
7.4.60.0100.01316.56
7.4.50.0030.00516.81
7.4.40.0090.00622.27
7.4.30.0090.00616.83
7.4.00.0070.00715.15
7.3.330.0000.00713.39
7.3.320.0000.00713.45
7.3.310.0070.00016.47
7.3.300.0000.00716.48
7.3.290.0070.00716.46
7.3.280.0120.00516.43
7.3.270.0030.01517.18
7.3.260.0160.00618.24
7.3.250.0110.00716.70
7.3.240.0120.00616.52
7.3.230.0170.00716.54
7.3.210.0080.00816.67
7.3.200.0090.01119.39
7.3.190.0130.00916.82
7.3.180.0040.01216.69
7.3.170.0130.00216.69
7.3.160.0060.00916.49
7.3.120.0070.00715.22
7.2.330.0120.00616.63
7.2.320.0110.00716.71
7.2.310.0090.01216.63
7.2.300.0110.00716.77
7.2.290.0070.01016.60
7.2.00.0030.01119.59
7.1.100.0060.01218.07
7.1.70.0070.00017.48
7.1.60.0070.01019.40
7.1.50.0030.01017.27
7.1.00.0070.07022.48
7.0.200.0060.00316.57
7.0.140.0070.07322.18
7.0.110.0100.08020.11
7.0.100.0070.08020.02
7.0.90.0070.07719.92
7.0.80.0200.06719.98
7.0.70.0030.05319.96
7.0.60.0000.05020.08
7.0.50.0170.04020.29
7.0.40.0130.07320.19
7.0.30.0130.08020.15
7.0.20.0070.08320.24
7.0.10.0000.08020.03
7.0.00.0000.07019.95
5.6.280.0030.07321.16
5.6.250.0130.04020.77
5.6.240.0100.06720.58
5.6.230.0130.08320.48
5.6.220.0170.07720.56
5.6.210.0100.08320.59
5.6.200.0070.08321.14
5.6.190.0170.07721.15
5.6.180.0170.06721.30
5.6.170.0100.07021.28
5.6.160.0130.07721.29
5.6.150.0070.05720.96
5.6.140.0170.07321.06
5.6.130.0100.07721.30
5.6.120.0130.07021.13
5.6.110.0130.08021.14
5.6.100.0130.07321.03
5.6.90.0070.08321.07
5.6.80.0070.08020.43
5.6.70.0100.08020.51
5.6.60.0130.07020.60
5.6.50.0130.04720.45
5.6.40.0030.04720.44
5.6.30.0070.08020.30
5.6.20.0170.06320.65
5.6.10.0100.07020.43
5.6.00.0070.08020.48
5.5.380.0100.08020.57
5.5.370.0170.04320.39
5.5.360.0030.08720.32
5.5.350.0100.04020.48
5.5.340.0070.07020.76
5.5.330.0030.08321.03
5.5.320.0170.06720.84
5.5.310.0100.06720.90
5.5.300.0100.07320.85
5.5.290.0130.07320.90
5.5.280.0200.07720.79
5.5.270.0030.08020.89
5.5.260.0100.08020.75
5.5.250.0030.09020.60
5.5.240.0100.07320.29
5.5.230.0030.04720.34
5.5.220.0130.05320.09
5.5.210.0170.07020.40
5.5.200.0030.06720.25
5.5.190.0030.07320.32
5.5.180.0130.07020.25
5.5.160.0070.07720.18
5.5.150.0200.06320.16
5.5.140.0170.06720.10
5.5.130.0070.08320.33
5.5.120.0230.07020.14
5.5.110.0100.04020.20
5.5.100.0030.05720.07
5.5.90.0100.07720.03
5.5.80.0070.04720.16
5.5.70.0130.07720.11
5.5.60.0100.07320.02
5.5.50.0100.07020.25
5.5.40.0130.06719.98
5.5.30.0100.05020.00
5.5.20.0130.04320.27
5.5.10.0130.05720.15
5.5.00.0130.06320.16
5.4.450.0130.06019.30
5.4.440.0030.08719.47
5.4.430.0070.08019.56
5.4.420.0070.08019.32
5.4.410.0030.05019.20
5.4.400.0030.08719.02
5.4.390.0100.07319.17
5.4.380.0070.07319.18
5.4.370.0100.06719.00
5.4.360.0170.06319.18
5.4.350.0100.07719.24
5.4.340.0070.08319.18
5.4.320.0030.08319.18
5.4.310.0130.06719.14
5.4.300.0030.08319.00
5.4.290.0070.06319.13
5.4.280.0070.07319.24
5.4.270.0100.03719.09
5.4.260.0070.05718.95
5.4.250.0100.04719.13
5.4.240.0200.06719.01
5.4.230.0100.04719.18
5.4.220.0030.08019.00
5.4.210.0070.06719.33
5.4.200.0070.07719.13
5.4.190.0070.07718.96
5.4.180.0100.07019.18
5.4.170.0100.07719.30
5.4.160.0130.07319.22
5.4.150.0000.08319.32
5.4.140.0070.07316.52
5.4.130.0070.07316.36
5.4.120.0000.08016.46
5.4.110.0030.07716.31
5.4.100.0030.08016.59
5.4.90.0170.07016.53
5.4.80.0100.05316.74
5.4.70.0100.06716.25
5.4.60.0070.07016.40
5.4.50.0070.05716.56
5.4.40.0000.05016.43
5.4.30.0100.06716.38
5.4.20.0100.06716.52
5.4.10.0030.07316.33
5.4.00.0170.06015.80
5.3.290.0100.06014.53
5.3.280.0130.07014.74
5.3.270.0100.07314.61
5.3.260.0070.07314.49
5.3.250.0030.07714.59
5.3.240.0000.07714.47
5.3.230.0130.07014.59
5.3.220.0070.07314.71
5.3.210.0070.07714.56
5.3.200.0070.04714.80
5.3.190.0100.04314.71
5.3.180.0200.06314.66
5.3.170.0000.05014.59
5.3.160.0070.07014.66
5.3.150.0030.07714.45
5.3.140.0100.07014.53
5.3.130.0030.07714.65
5.3.120.0070.06714.59
5.3.110.0070.08014.57
5.3.100.0070.06714.05
5.3.90.0030.04714.01
5.3.80.0070.07714.02
5.3.70.0130.05314.12
5.3.60.0070.07013.97
5.3.50.0070.07314.02
5.3.40.0070.07014.11
5.3.30.0030.07713.89
5.3.20.0100.07013.71
5.3.10.0030.08013.75
5.3.00.0130.06313.64
5.2.170.0030.06711.16
5.2.160.0000.06711.22
5.2.150.0070.06011.17
5.2.140.0070.05711.14
5.2.130.0030.06311.11
5.2.120.0100.05311.18
5.2.110.0070.06311.12
5.2.100.0030.06310.97
5.2.90.0100.06011.07
5.2.80.0070.06011.11
5.2.70.0000.07011.12
5.2.60.0130.05011.03
5.2.50.0070.04711.02
5.2.40.0030.05711.11
5.2.30.0100.05311.08
5.2.20.0000.06010.99
5.2.10.0100.05711.10
5.2.00.0100.05710.86
5.1.60.0070.05010.09
5.1.50.0000.0579.97
5.1.40.0100.0439.96
5.1.30.0030.05010.58
5.1.20.0070.05010.33
5.1.10.0070.05310.05
5.1.00.0030.05710.18
5.0.50.0170.0378.52
5.0.40.0070.0338.50
5.0.30.0070.0408.23
5.0.20.0070.0138.17
5.0.10.0000.0478.01
5.0.00.0000.0308.13
4.4.90.0030.0307.96
4.4.80.0000.0377.96
4.4.70.0030.0337.96
4.4.60.0070.0237.96
4.4.50.0000.0337.96
4.4.40.0100.0477.96
4.4.30.0070.0337.96
4.4.20.0030.0337.96
4.4.10.0030.0337.96
4.4.00.0000.0577.96
4.3.110.0000.0307.96
4.3.100.0000.0177.96
4.3.90.0000.0137.96
4.3.80.0030.0207.96
4.3.70.0030.0137.96
4.3.60.0030.0137.96
4.3.50.0030.0177.96
4.3.40.0030.0237.96
4.3.30.0000.0177.96
4.3.20.0030.0177.96
4.3.10.0000.0207.96
4.3.00.0000.0207.96

preferences:
47.73 ms | 401 KiB | 5 Q