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.00618.56
8.3.50.0090.01016.88
8.3.40.0090.00618.92
8.3.30.0160.00318.89
8.3.20.0050.00318.85
8.3.10.0060.00320.78
8.3.00.0060.00317.75
8.2.180.0100.01016.50
8.2.170.0090.00622.96
8.2.160.0110.00322.25
8.2.150.0000.00824.18
8.2.140.0040.01124.66
8.2.130.0050.00326.16
8.2.120.0040.00419.98
8.2.110.0000.01121.31
8.2.100.0040.00817.97
8.2.90.0030.00619.48
8.2.80.0060.00319.34
8.2.70.0050.00517.75
8.2.60.0000.00817.93
8.2.50.0070.00318.07
8.2.40.0000.00818.16
8.2.30.0060.00318.17
8.2.20.0040.00417.83
8.2.10.0080.00017.85
8.2.00.0050.00317.99
8.1.280.0110.00425.92
8.1.270.0040.00424.66
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00920.21
8.1.230.0080.00321.10
8.1.220.0000.00817.74
8.1.210.0040.00418.83
8.1.200.0030.00717.61
8.1.190.0040.00417.64
8.1.180.0060.00318.10
8.1.170.0060.00318.87
8.1.160.0040.00419.01
8.1.150.0030.00518.89
8.1.140.0070.00017.66
8.1.130.0030.00317.87
8.1.120.0040.00417.55
8.1.110.0040.00417.66
8.1.100.0040.00417.61
8.1.90.0000.00717.65
8.1.80.0030.00517.65
8.1.70.0000.00717.62
8.1.60.0000.00917.75
8.1.50.0030.00617.57
8.1.40.0060.00317.73
8.1.30.0000.00817.80
8.1.20.0060.00317.90
8.1.10.0040.00417.65
8.1.00.0080.00017.66
8.0.300.0040.00420.20
8.0.290.0000.00716.75
8.0.280.0000.00718.50
8.0.270.0050.00318.18
8.0.260.0070.00016.90
8.0.250.0050.00317.15
8.0.240.0110.00017.17
8.0.230.0070.00017.04
8.0.220.0070.00017.04
8.0.210.0000.00817.07
8.0.200.0060.00017.16
8.0.190.0050.00217.05
8.0.180.0040.00417.14
8.0.170.0000.00917.13
8.0.160.0090.00016.98
8.0.150.0000.00817.01
8.0.140.0170.00016.99
8.0.130.0060.00013.48
8.0.120.0000.00717.08
8.0.110.0040.00417.10
8.0.100.0000.00717.04
8.0.90.0080.00017.18
8.0.80.0030.01217.10
8.0.70.0000.00717.04
8.0.60.0050.00217.11
8.0.50.0040.00417.18
8.0.30.0090.01417.58
8.0.20.0090.00917.22
8.0.10.0040.00417.21
8.0.00.0080.01417.14
7.4.330.0050.00014.96
7.4.320.0060.00016.91
7.4.300.0060.00016.93
7.4.290.0040.00416.92
7.4.280.0000.00716.87
7.4.270.0070.00016.84
7.4.260.0030.00313.61
7.4.250.0040.00416.86
7.4.240.0000.00716.88
7.4.230.0030.00317.02
7.4.220.0110.00716.81
7.4.210.0060.01016.82
7.4.200.0070.00016.71
7.4.190.0040.00416.98
7.4.160.0080.01116.70
7.4.150.0090.00917.18
7.4.140.0120.00817.31
7.4.130.0090.00916.81
7.4.120.0070.01016.89
7.4.110.0090.00916.72
7.4.100.0100.00716.58
7.4.90.0130.00516.80
7.4.80.0090.01618.80
7.4.70.0130.01016.70
7.4.60.0060.01216.79
7.4.50.0030.00616.59
7.4.40.0040.01222.27
7.4.30.0100.01316.79
7.4.10.0070.01416.64
7.4.00.0090.00915.57
7.3.330.0030.00313.24
7.3.320.0030.00313.37
7.3.310.0000.00716.32
7.3.300.0040.00416.43
7.3.290.0080.01116.43
7.3.280.0060.01216.44
7.3.270.0090.00917.18
7.3.260.0110.00918.24
7.3.250.0200.01716.76
7.3.240.0040.01516.51
7.3.230.0130.01016.80
7.3.210.0090.00916.48
7.3.200.0140.00416.45
7.3.190.0090.00916.50
7.3.180.0030.01216.36
7.3.170.0140.00316.68
7.3.160.0160.00016.61
7.3.130.0030.01016.74
7.3.120.0100.00815.61
7.3.110.0060.00815.83
7.3.100.0080.00815.82
7.3.90.0050.01215.63
7.3.80.0060.00915.96
7.3.70.0060.00715.75
7.3.60.0050.01115.58
7.3.50.0060.00615.70
7.3.40.0070.00915.84
7.3.30.0100.00315.75
7.3.20.0070.01017.62
7.3.10.0100.00917.28
7.3.00.0110.00717.32
7.2.330.0130.01316.83
7.2.320.0060.01616.64
7.2.310.0180.00616.67
7.2.300.0080.00816.92
7.2.290.0100.00616.77
7.2.260.0100.01016.89
7.2.250.0040.01315.94
7.2.240.0030.01516.02
7.2.230.0060.00916.05
7.2.220.0080.00615.98
7.2.210.0020.01315.94
7.2.200.0090.00415.96
7.2.190.0080.00816.16
7.2.180.0070.00915.89
7.2.170.0030.00815.81
7.2.160.0110.00716.72
7.2.150.0030.01618.70
7.2.140.0040.01418.65
7.2.130.0070.00717.64
7.2.120.0110.01117.63
7.2.110.0120.00917.73
7.2.100.0110.00617.61
7.2.90.0070.00717.89
7.2.80.0070.01217.70
7.2.70.0090.00817.53
7.2.60.0110.00717.44
7.2.50.0060.01217.61
7.2.40.0100.00817.82
7.2.30.0060.01417.57
7.2.20.0160.00317.45
7.2.10.0120.00817.73
7.2.00.0110.00617.70
7.1.330.0080.00716.81
7.1.320.0080.00516.52
7.1.310.0040.01116.67
7.1.300.0070.00316.77
7.1.290.0080.00516.88
7.1.280.0070.00416.64
7.1.270.0070.00716.69
7.1.260.0040.01116.71
7.1.250.0070.01216.68
7.1.240.0040.01217.60
7.1.230.0030.01317.46
7.1.220.0150.00017.61
7.1.210.0030.01017.29
7.1.200.0110.00417.57
7.1.190.0060.00917.44
7.1.180.0120.00317.33
7.1.170.0000.01117.50
7.1.160.0110.00417.55
7.1.150.0070.01117.48
7.1.140.0030.01317.54
7.1.130.0060.00617.42
7.1.120.0080.00417.57
7.1.110.0030.00617.38
7.1.100.0030.01317.40
7.1.90.0060.00617.39
7.1.80.0060.00617.62
7.1.70.0050.00617.41
7.1.60.0060.01118.45
7.1.50.0050.01217.35
7.1.40.0000.01517.46
7.1.30.0040.00717.55
7.1.20.0060.00917.39
7.1.10.0140.00317.50
7.1.00.0100.04019.88
7.0.330.0030.00617.30
7.0.320.0110.00417.04
7.0.310.0060.00317.09
7.0.300.0070.00717.25
7.0.290.0100.00017.04
7.0.280.0040.01117.04
7.0.270.0060.00617.33
7.0.260.0060.00917.41
7.0.250.0060.00617.23
7.0.240.0060.01017.10
7.0.230.0060.00317.18
7.0.220.0070.00717.09
7.0.210.0100.00317.04
7.0.200.0040.00616.98
7.0.190.0060.00917.24
7.0.180.0060.00917.04
7.0.170.0040.00817.10
7.0.160.0060.00617.13
7.0.150.0030.01016.93
7.0.140.0050.04219.50
7.0.130.0070.01017.21
7.0.120.0070.00717.22
7.0.110.0070.01117.36
7.0.100.0100.00717.14
7.0.90.0060.01017.22
7.0.80.0110.00617.29
7.0.70.0070.01017.09
7.0.60.0230.03818.46
7.0.50.0030.03317.55
7.0.40.0090.04116.50
7.0.30.0120.04016.54
7.0.20.0030.03416.48
7.0.10.0050.04216.44
7.0.00.0070.04116.35
5.6.400.0030.01315.80
5.6.390.0040.01215.79
5.6.380.0090.00616.09
5.6.370.0040.00716.14
5.6.360.0070.00316.30
5.6.350.0060.00916.04
5.6.340.0000.01316.05
5.6.330.0000.01216.14
5.6.320.0080.00616.11
5.6.310.0060.00916.04
5.6.300.0080.01116.07
5.6.290.0070.01016.03
5.6.280.0050.03818.36
5.6.270.0070.00715.91
5.6.260.0060.00315.80
5.6.250.0060.00616.06
5.6.240.0120.00615.89
5.6.230.0000.01215.95
5.6.220.0100.00715.80
5.6.210.0100.03918.28
5.6.200.0050.03817.05
5.6.190.0070.04517.05
5.6.180.0070.03817.01
5.6.170.0080.03517.17
5.6.160.0140.03717.02
5.6.150.0120.03917.04
5.6.140.0090.04017.12
5.6.130.0120.01717.06
5.6.120.0070.03717.14
5.6.110.0110.02817.04
5.6.100.0070.03916.98
5.6.90.0030.05017.07
5.6.80.0080.04216.75
5.6.70.0050.02816.69
5.6.60.0110.03916.77
5.6.50.0050.03416.79
5.6.40.0020.02616.75
5.6.30.0060.04616.67
5.6.20.0110.01616.56
5.6.10.0090.03916.78
5.6.00.0080.03516.80
5.5.380.0030.01015.94
5.5.370.0030.00915.78
5.5.360.0120.00615.67
5.5.350.0100.04118.09
5.5.340.0110.04117.02
5.5.330.0070.03316.84
5.5.320.0050.02416.88
5.5.310.0080.04116.83
5.5.300.0070.04116.99
5.5.290.0080.04516.80
5.5.280.0080.04316.96
5.5.270.0060.03116.98
5.5.260.0100.03216.91
5.5.250.0050.04316.74
5.5.240.0040.02916.63
5.5.230.0070.03316.58
5.5.220.0120.03916.58
5.5.210.0050.03716.58
5.5.200.0030.02616.63
5.5.190.0090.04116.62
5.5.180.0050.03716.49
5.5.170.0000.01515.91
5.5.160.0070.03716.61
5.5.150.0080.02716.61
5.5.140.0100.02016.54
5.5.130.0020.03416.64
5.5.120.0090.04216.66
5.5.110.0090.02216.64
5.5.100.0070.04516.42
5.5.90.0060.04116.45
5.5.80.0060.04316.57
5.5.70.0030.02716.54
5.5.60.0080.02016.51
5.5.50.0050.02316.56
5.5.40.0020.02816.49
5.5.30.0060.01916.43
5.5.20.0050.02416.54
5.5.10.0050.02316.56
5.5.00.0030.02416.58
5.4.450.0040.03416.50
5.4.440.0030.04516.37
5.4.430.0120.03416.38
5.4.420.0100.03716.42
5.4.410.0100.03516.35
5.4.400.0080.04216.21
5.4.390.0080.04116.33
5.4.380.0100.03416.20
5.4.370.0080.03516.24
5.4.360.0080.01816.22
5.4.350.0070.02116.18
5.4.340.0100.02016.24
5.4.330.0000.00713.39
5.4.320.0040.04416.22
5.4.310.0030.03216.20
5.4.300.0050.03816.24
5.4.290.0080.04016.22
5.4.280.0100.04016.25
5.4.270.0110.02516.26
5.4.260.0030.04216.22
5.4.250.0080.03816.21
5.4.240.0050.03516.20
5.4.230.0050.02416.21
5.4.220.0020.02516.24
5.4.210.0030.02316.24
5.4.200.0040.02216.13
5.4.190.0030.02316.32
5.4.180.0050.02216.24
5.4.170.0030.02316.24
5.4.160.0030.02416.25
5.4.150.0000.02716.25
5.4.140.0070.01814.92
5.4.130.0070.02014.87
5.4.120.0060.02014.93
5.4.110.0050.02014.95
5.4.100.0050.02114.93
5.4.90.0060.02014.94
5.4.80.0050.01814.91
5.4.70.0070.02014.93
5.4.60.0030.02014.87
5.4.50.0060.01814.96
5.4.40.0050.01814.94
5.4.30.0060.01914.88
5.4.20.0030.02114.85
5.4.10.0090.02514.88
5.4.00.0050.02114.57
5.3.290.0080.03014.06
5.3.280.0060.02114.01
5.3.270.0040.02114.01
5.3.260.0020.02214.01
5.3.250.0080.02513.98
5.3.240.0020.02614.03
5.3.230.0030.02214.01
5.3.220.0040.02013.96
5.3.210.0050.02213.96
5.3.200.0030.02313.97
5.3.190.0030.02214.03
5.3.180.0050.02213.99
5.3.170.0020.02213.97
5.3.160.0050.01913.99
5.3.150.0000.02514.03
5.3.140.0020.02314.02
5.3.130.0030.02213.98
5.3.120.0020.02213.99
5.3.110.0040.02013.89
5.3.100.0030.02213.71
5.3.90.0070.01713.72
5.3.80.0020.02113.80
5.3.70.0020.02313.62
5.3.60.0050.02413.71
5.3.50.0020.02313.68
5.3.40.0030.02313.61
5.3.30.0030.02513.67
5.3.20.0050.02813.56
5.3.10.0070.03013.47
5.3.00.0030.02413.52
5.2.170.0000.03311.23
5.2.160.0030.03011.23
5.2.150.0030.06011.23
5.2.140.0070.05711.23
5.2.130.0030.03311.23
5.2.120.0000.03011.23
5.2.110.0070.03311.23
5.2.100.0070.03011.23
5.2.90.0030.05011.31
5.2.80.0100.06311.23
5.2.70.0030.06311.23
5.2.60.0030.06011.26
5.2.50.0030.06311.23
5.2.40.0070.06011.23
5.2.30.0200.05011.23
5.2.20.0030.04011.23
5.2.10.0030.03711.23
5.2.00.0030.06311.23
5.1.60.0130.02011.23
5.1.50.0100.05011.23
5.1.40.0030.04011.23
5.1.30.0100.04311.23
5.1.20.0070.05311.23
5.1.10.0070.05711.23
5.1.00.0070.05711.23
5.0.50.0030.05011.23
5.0.40.0030.03011.23
5.0.30.0070.05711.23
5.0.20.0030.04311.23
5.0.10.0030.03011.23
5.0.00.0030.06311.23
4.4.90.0070.01711.23
4.4.80.0000.04011.23
4.4.70.0030.01711.23
4.4.60.0000.02011.23
4.4.50.0030.02011.23
4.4.40.0030.05711.23
4.4.30.0030.02711.23
4.4.20.0030.03311.23
4.4.10.0030.03311.23
4.4.00.0030.05011.23
4.3.110.0070.03011.23
4.3.100.0000.03311.23
4.3.90.0070.02311.23
4.3.80.0000.03711.23
4.3.70.0030.01711.23
4.3.60.0070.03311.23
4.3.50.0070.02711.23
4.3.40.0030.04711.23
4.3.30.0000.02311.23
4.3.20.0000.02011.23
4.3.10.0030.02311.23
4.3.00.0000.02711.23

preferences:
60.13 ms | 401 KiB | 5 Q