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.0110.01416.75
8.3.50.0130.00422.13
8.3.40.0040.01118.96
8.3.30.0060.00819.21
8.3.20.0000.00720.29
8.3.10.0090.00023.66
8.3.00.0050.00320.68
8.2.180.0030.01316.75
8.2.170.0150.00022.96
8.2.160.0090.00622.38
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0000.00822.23
8.2.110.0060.00322.38
8.2.100.0030.00918.09
8.2.90.0080.00019.22
8.2.80.0030.00618.05
8.2.70.0000.00817.88
8.2.60.0000.00817.93
8.2.50.0040.00418.07
8.2.40.0070.00319.28
8.2.30.0080.00018.25
8.2.20.0050.00317.96
8.2.10.0000.00919.70
8.2.00.0030.00518.04
8.1.280.0110.00425.92
8.1.270.0080.00023.89
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0030.00623.79
8.1.230.0040.00819.13
8.1.220.0000.00817.74
8.1.210.0000.00818.77
8.1.200.0060.00317.60
8.1.190.0040.00417.78
8.1.180.0000.00818.10
8.1.170.0040.00418.86
8.1.160.0000.00722.05
8.1.150.0040.00418.88
8.1.140.0000.00717.70
8.1.130.0000.00717.86
8.1.120.0000.00817.63
8.1.110.0040.00417.61
8.1.100.0000.00717.60
8.1.90.0000.00817.54
8.1.80.0070.00017.61
8.1.70.0000.00817.53
8.1.60.0090.00017.79
8.1.50.0000.00817.69
8.1.40.0040.00417.70
8.1.30.0000.00817.68
8.1.20.0050.00317.88
8.1.10.0000.00817.71
8.1.00.0030.00617.68
8.0.300.0040.00418.77
8.0.290.0030.00617.16
8.0.280.0030.00518.35
8.0.270.0000.00717.22
8.0.260.0070.00017.00
8.0.250.0000.00717.17
8.0.240.0040.00417.03
8.0.230.0030.00517.11
8.0.220.0000.00717.01
8.0.210.0040.00317.07
8.0.200.0000.00717.07
8.0.190.0000.00717.13
8.0.180.0000.00917.01
8.0.170.0040.00417.08
8.0.160.0040.00417.06
8.0.150.0060.00617.03
8.0.140.0070.00017.00
8.0.130.0000.00613.57
8.0.120.0050.00517.07
8.0.110.0040.00417.03
8.0.100.0050.00217.09
8.0.90.0000.00717.26
8.0.80.0130.01017.13
8.0.70.0050.00317.09
8.0.60.0040.00417.13
8.0.50.0060.00317.17
8.0.30.0100.01217.27
8.0.20.0120.00817.51
8.0.10.0000.00817.06
8.0.00.0120.00917.08
7.4.330.0000.00515.14
7.4.320.0030.00316.91
7.4.300.0000.00716.95
7.4.290.0030.00316.83
7.4.280.0030.00316.80
7.4.270.0050.00316.82
7.4.260.0000.00716.87
7.4.250.0050.00316.74
7.4.240.0060.00116.82
7.4.230.0070.00016.72
7.4.220.0070.01116.98
7.4.210.0120.00716.81
7.4.200.0040.00416.86
7.4.190.0040.00416.91
7.4.160.0080.00816.53
7.4.150.0100.00617.40
7.4.140.0090.00917.86
7.4.130.0090.01216.77
7.4.120.0100.01116.89
7.4.110.0130.00416.76
7.4.100.0070.01116.73
7.4.90.0120.00616.84
7.4.80.0100.00716.70
7.4.70.0100.01316.61
7.4.60.0140.00316.77
7.4.50.0040.00416.51
7.4.40.0040.01222.77
7.4.30.0110.00716.66
7.4.10.0070.01416.87
7.4.00.0050.01015.76
7.3.330.0030.00313.27
7.3.320.0000.00513.43
7.3.310.0030.00516.59
7.3.300.0050.00316.48
7.3.290.0070.01016.50
7.3.280.0120.00816.48
7.3.270.0140.00417.40
7.3.260.0110.01116.54
7.3.250.0080.01016.83
7.3.240.0110.00616.50
7.3.230.0070.01316.69
7.3.210.0090.00616.41
7.3.200.0100.01119.39
7.3.190.0130.00616.75
7.3.180.0060.01016.57
7.3.170.0130.00316.71
7.3.160.0150.00316.58
7.3.130.0090.00916.57
7.3.120.0060.01015.61
7.3.110.0090.00815.89
7.3.100.0100.00715.82
7.3.90.0040.01115.81
7.3.80.0090.00416.05
7.3.70.0080.00715.79
7.3.60.0050.01315.68
7.3.50.0050.00815.82
7.3.40.0050.01315.81
7.3.30.0090.00915.62
7.3.20.0050.01217.51
7.3.10.0070.00917.63
7.3.00.0030.00717.54
7.2.330.0120.00616.96
7.2.320.0110.00916.88
7.2.310.0090.00916.85
7.2.300.0070.01016.94
7.2.290.0130.00316.83
7.2.260.0060.00916.93
7.2.250.0080.01116.08
7.2.240.0120.00616.01
7.2.230.0060.01115.96
7.2.220.0100.00516.06
7.2.210.0060.00615.90
7.2.200.0080.00815.92
7.2.190.0050.01015.79
7.2.180.0070.00715.91
7.2.170.0070.00815.95
7.2.160.0080.01015.88
7.2.150.0080.00617.76
7.2.140.0070.01017.92
7.2.130.0070.01017.74
7.2.120.0060.00917.82
7.2.110.0070.01017.89
7.2.100.0080.01217.79
7.2.90.0030.01417.89
7.2.80.0080.00717.81
7.2.70.0070.00717.71
7.2.60.0070.00917.90
7.2.50.0070.00917.91
7.2.40.0110.00517.70
7.2.30.0030.00917.71
7.2.20.0070.00517.97
7.2.10.0080.00917.93
7.2.00.0070.00718.29
7.1.330.0080.01016.76
7.1.320.0050.00816.69
7.1.310.0030.01016.80
7.1.300.0090.00716.61
7.1.290.0090.00616.58
7.1.280.0080.00716.67
7.1.270.0030.01416.79
7.1.260.0060.00916.72
7.1.250.0030.01416.90
7.1.240.0090.00616.82
7.1.230.0050.01116.72
7.1.220.0070.00616.71
7.1.210.0080.00616.63
7.1.200.0030.01016.46
7.1.190.0050.01016.75
7.1.180.0060.00916.78
7.1.170.0030.01016.62
7.1.160.0080.00516.63
7.1.150.0080.00616.85
7.1.140.0050.01116.75
7.1.130.0030.01116.67
7.1.120.0030.00816.66
7.1.110.0050.00816.74
7.1.100.0030.00717.09
7.1.90.0040.01116.75
7.1.80.0070.00916.70
7.1.70.0020.01116.86
7.1.60.0090.00817.56
7.1.50.0120.00516.83
7.1.40.0050.00716.73
7.1.30.0070.00716.86
7.1.20.0080.00716.82
7.1.10.0050.00816.61
7.1.00.0070.02818.52
7.0.330.0050.00916.34
7.0.320.0050.00616.15
7.0.310.0080.00816.24
7.0.300.0070.00516.32
7.0.290.0030.00916.47
7.0.280.0060.00816.45
7.0.270.0090.00516.22
7.0.260.0040.00916.34
7.0.250.0080.00416.32
7.0.240.0030.01016.42
7.0.230.0060.00816.40
7.0.220.0050.00816.40
7.0.210.0050.01016.41
7.0.200.0070.00516.57
7.0.190.0060.00716.08
7.0.180.0070.01016.40
7.0.170.0030.00816.49
7.0.160.0050.00916.35
7.0.150.0090.00816.23
7.0.140.0080.02618.36
7.0.130.0100.00216.34
7.0.120.0050.00516.41
7.0.110.0050.00716.40
7.0.100.0070.02317.56
7.0.90.0110.03117.51
7.0.80.0060.02917.53
7.0.70.0090.02017.39
7.0.60.0100.02417.49
7.0.50.0070.03017.65
7.0.40.0060.01816.19
7.0.30.0090.02616.09
7.0.20.0060.01716.29
7.0.10.0060.03216.21
7.0.00.0080.02016.07
5.6.400.0040.01015.20
5.6.390.0030.01115.01
5.6.380.0030.01215.13
5.6.370.0070.00815.46
5.6.360.0040.01115.24
5.6.350.0050.00615.36
5.6.340.0030.01115.21
5.6.330.0070.00515.19
5.6.320.0090.00715.18
5.6.310.0070.00515.17
5.6.300.0050.01115.23
5.6.290.0070.00515.29
5.6.280.0080.02617.13
5.6.270.0050.00515.39
5.6.260.0040.00615.07
5.6.250.0070.02317.02
5.6.240.0050.02316.96
5.6.230.0060.02417.06
5.6.220.0050.02716.95
5.6.210.0140.01516.94
5.6.200.0040.02317.13
5.6.190.0060.02917.13
5.6.180.0050.02417.16
5.6.170.0050.02817.15
5.6.160.0070.02317.05
5.6.150.0040.02417.02
5.6.140.0080.02517.13
5.6.130.0030.02417.10
5.6.120.0080.03117.14
5.6.110.0010.02617.04
5.6.100.0090.02117.05
5.6.90.0080.02617.08
5.6.80.0060.02816.82
5.6.70.0080.01716.81
5.6.60.0080.02916.87
5.6.50.0050.02816.89
5.6.40.0070.03116.92
5.6.30.0070.02916.77
5.6.20.0120.02716.86
5.6.10.0080.03316.92
5.6.00.0020.02016.88
5.5.380.0070.02716.83
5.5.370.0080.01816.87
5.5.360.0050.02416.88
5.5.350.0070.02516.95
5.5.340.0090.03117.02
5.5.330.0050.02316.95
5.5.320.0110.01216.88
5.5.310.0050.02417.09
5.5.300.0070.02516.97
5.5.290.0100.02816.85
5.5.280.0080.02217.00
5.5.270.0090.03016.83
5.5.260.0060.02016.98
5.5.250.0070.03216.96
5.5.240.0100.02116.65
5.5.230.0100.03016.72
5.5.220.0070.02216.74
5.5.210.0050.02616.65
5.5.200.0130.01516.82
5.5.190.0090.02416.71
5.5.180.0090.02016.75
5.5.170.0060.00614.90
5.5.160.0090.03016.63
5.5.150.0050.03216.70
5.5.140.0080.02116.49
5.5.130.0090.02416.72
5.5.120.0060.02216.79
5.5.110.0090.02216.70
5.5.100.0040.03116.65
5.5.90.0030.02116.64
5.5.80.0070.02616.56
5.5.70.0100.01816.67
5.5.60.0040.02516.51
5.5.50.0090.01816.78
5.5.40.0020.01916.69
5.5.30.0070.01616.74
5.5.20.0060.02416.57
5.5.10.0050.01916.68
5.5.00.0060.03216.62
5.4.450.0080.02914.58
5.4.440.0060.02214.44
5.4.430.0060.01814.45
5.4.420.0030.02014.43
5.4.410.0030.02014.40
5.4.400.0070.02814.30
5.4.390.0060.03014.25
5.4.380.0060.02914.22
5.4.370.0070.01914.28
5.4.360.0030.02214.37
5.4.350.0070.03014.25
5.4.340.0060.02914.24
5.4.330.0030.00711.85
5.4.320.0080.03414.26
5.4.310.0030.01914.32
5.4.300.0070.02914.26
5.4.290.0020.02814.36
5.4.280.0050.03014.25
5.4.270.0090.02714.09
5.4.260.0030.02914.23
5.4.250.0110.02114.29
5.4.240.0020.01914.30
5.4.230.0040.01814.13
5.4.220.0050.03014.33
5.4.210.0050.01814.31
5.4.200.0050.02914.20
5.4.190.0020.02514.40
5.4.180.0070.01614.24
5.4.170.0070.02714.04
5.4.160.0050.02014.32
5.4.150.0050.03214.31
5.4.140.0040.03013.28
5.4.130.0100.01413.33
5.4.120.0050.02913.37
5.4.110.0090.02613.40
5.4.100.0030.01813.52
5.4.90.0070.02713.47
5.4.80.0050.02513.32
5.4.70.0050.02913.30
5.4.60.0060.02013.39
5.4.50.0100.01513.26
5.4.40.0080.02313.24
5.4.30.0070.02613.33
5.4.20.0080.02413.39
5.4.10.0060.02713.19
5.4.00.0040.03013.15
5.3.290.0110.01212.93
5.3.280.0020.01912.64
5.3.270.0070.02712.75
5.3.260.0050.02812.81
5.3.250.0040.01712.77
5.3.240.0060.01812.70
5.3.230.0070.01812.75
5.3.220.0070.01912.67
5.3.210.0020.02712.72
5.3.200.0040.02712.62
5.3.190.0040.02712.79
5.3.180.0060.02512.80
5.3.170.0050.01612.81
5.3.160.0050.02412.82
5.3.150.0080.02612.78
5.3.140.0040.02812.79
5.3.130.0030.02012.77
5.3.120.0050.02712.68
5.3.110.0020.02912.83
5.3.100.0070.02212.59
5.3.90.0030.03012.56
5.3.80.0090.02412.53
5.3.70.0030.02512.44
5.3.60.0030.03212.63
5.3.50.0040.02312.46
5.3.40.0080.02712.50
5.3.30.0030.03112.60
5.3.20.0100.02212.50
5.3.10.0050.02112.29
5.3.00.0050.03012.25
5.2.170.0030.06311.13
5.2.160.0030.06011.23
5.2.150.0000.06311.00
5.2.140.0000.03311.28
5.2.130.0030.06311.20
5.2.120.0130.05010.98
5.2.110.0030.03311.16
5.2.100.0100.06011.20
5.2.90.0130.03011.15
5.2.80.0030.04310.96
5.2.70.0030.02711.16
5.2.60.0070.06311.11
5.2.50.0000.04011.05
5.2.40.0030.06010.99
5.2.30.0030.06011.10
5.2.20.0070.04710.88
5.2.10.0100.05710.76
5.2.00.0100.04310.71
5.1.60.0070.02710.08
5.1.50.0000.04710.09
5.1.40.0030.05310.08
5.1.30.0070.05710.45
5.1.20.0130.04710.27
5.1.10.0070.02710.14
5.1.00.0000.03710.17
5.0.50.0070.0438.57
5.0.40.0070.0208.45
5.0.30.0000.0438.29
5.0.20.0100.0378.28
5.0.10.0100.0408.18
5.0.00.0030.0438.20
4.4.90.0070.0307.68
4.4.80.0030.0307.68
4.4.70.0000.0237.68
4.4.60.0000.0207.68
4.4.50.0070.0307.68
4.4.40.0000.0377.68
4.4.30.0030.0177.68
4.4.20.0030.0337.68
4.4.10.0030.0337.68
4.4.00.0000.0477.68
4.3.110.0000.0307.68
4.3.100.0030.0377.68
4.3.90.0000.0277.68
4.3.80.0030.0477.68
4.3.70.0030.0207.68
4.3.60.0000.0407.68
4.3.50.0000.0337.68
4.3.40.0030.0437.68
4.3.30.0000.0237.68
4.3.20.0000.0337.68
4.3.10.0000.0237.68
4.3.00.0070.0307.68

preferences:
43.43 ms | 401 KiB | 5 Q