3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Remove a query string parameter from an URL. * * @param string $url * @param string $varname * * @return string */ function removeQueryStringParameter($url, $varname) { $parsedUrl = parse_url($url); $query = array(); if (isset($parsedUrl['query'])) { parse_str($parsedUrl['query'], $query); unset($query[$varname]); } $path = isset($parsedUrl['path']) ? $parsedUrl['path'] : ''; $query = !empty($query) ? '?'. http_build_query($query) : ''; return $parsedUrl['scheme']. '://'. $parsedUrl['host']. $path. $query; } $urls = array( 'http://www.example.com?test=test', 'http://www.example.com?bar=foo&test=test2&foo2=dooh', 'http://www.example.com', 'http://www.example.com?foo=bar', 'http://www.example.com/test/no-empty-path/?foo=bar&test=test5', 'https://www.example.com/test/test.test?test=test6', ); foreach ($urls as $url) { echo $url.PHP_EOL; echo removeQueryStringParameter($url, 'test'). PHP_EOL. 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.4.20.0030.01717.83
8.4.10.0070.01319.22
8.3.150.0130.00716.59
8.3.140.0060.00318.91
8.3.130.0080.00016.68
8.3.120.0090.00018.83
8.3.110.0060.00320.94
8.3.100.0040.00424.06
8.3.90.0000.01026.77
8.3.80.0030.00616.63
8.3.70.0040.01116.63
8.3.60.0070.01416.50
8.3.50.0140.00717.28
8.3.40.0060.00918.69
8.3.30.0140.00418.66
8.3.20.0050.00322.04
8.3.10.0040.00421.95
8.3.00.0040.00423.60
8.2.260.0160.00316.48
8.2.250.0040.00416.78
8.2.240.0030.00617.23
8.2.230.0000.00822.58
8.2.220.0030.00637.54
8.2.210.0050.00326.77
8.2.200.0120.00018.41
8.2.190.0100.01016.58
8.2.180.0090.00918.46
8.2.170.0060.00922.96
8.2.160.0070.01020.38
8.2.150.0120.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0140.00020.48
8.2.110.0120.00620.39
8.2.100.0040.00718.09
8.2.90.0080.00019.32
8.2.80.0030.00617.97
8.2.70.0050.00317.93
8.2.60.0070.00019.34
8.2.50.0000.00818.10
8.2.40.0000.00820.64
8.2.30.0070.00418.15
8.2.20.0060.00318.18
8.2.10.0000.00718.10
8.2.00.0030.00618.21
8.1.310.0060.01218.59
8.1.300.0060.00317.94
8.1.290.0060.00318.88
8.1.280.0090.00625.92
8.1.270.0130.00934.83
8.1.260.0090.00626.35
8.1.250.0080.00028.09
8.1.240.0060.00319.14
8.1.230.0080.00419.18
8.1.220.0050.00317.74
8.1.210.0050.00318.77
8.1.200.0000.00817.35
8.1.190.0040.00419.01
8.1.180.0030.00518.10
8.1.170.0030.00518.50
8.1.160.0040.00422.04
8.1.150.0050.00220.16
8.1.140.0000.00817.66
8.1.130.0030.00317.42
8.1.120.0000.00717.44
8.1.110.0060.00317.52
8.1.100.0110.00017.35
8.1.90.0080.00017.51
8.1.80.0000.00817.46
8.1.70.0040.00417.38
8.1.60.0040.00417.49
8.1.50.0030.00517.44
8.1.40.0040.00417.56
8.1.30.0000.00817.66
8.1.20.0030.00517.62
8.1.10.0050.00317.56
8.1.00.0100.00017.46
8.0.300.0000.00819.55
8.0.290.0060.00316.75
8.0.280.0000.00718.38
8.0.270.0030.00316.89
8.0.260.0080.00016.75
8.0.250.0000.00717.00
8.0.240.0060.00316.96
8.0.230.0070.00016.94
8.0.220.0040.00416.80
8.0.210.0000.00716.89
8.0.200.0030.00316.86
8.0.190.0040.00417.00
8.0.180.0080.00316.84
8.0.170.0000.00716.99
8.0.160.0030.00616.92
8.0.150.0030.00516.86
8.0.140.0080.00016.87
8.0.130.0060.00013.41
8.0.120.0000.00916.87
8.0.110.0040.00416.91
8.0.100.0070.00016.69
8.0.90.0040.00416.88
8.0.80.0130.00316.88
8.0.70.0040.00416.86
8.0.60.0070.00016.82
8.0.50.0000.00716.86
8.0.30.0050.01316.88
8.0.20.0100.00817.40
8.0.10.0040.00417.06
8.0.00.0100.00716.92
7.4.330.0000.00515.55
7.4.320.0030.00316.45
7.4.300.0030.00316.43
7.4.290.0050.00316.63
7.4.280.0030.00616.63
7.4.270.0030.00316.49
7.4.260.0040.00416.50
7.4.250.0040.00416.52
7.4.240.0070.00016.59
7.4.230.0030.00316.43
7.4.220.0100.00616.58
7.4.210.0080.00816.70
7.4.200.0000.00716.67
7.4.160.0060.00916.52
7.4.150.0110.00917.40
7.4.140.0100.00717.86
7.4.130.0040.01516.59
7.4.120.0150.00416.49
7.4.110.0170.00016.55
7.4.100.0110.00516.50
7.4.90.0070.01116.52
7.4.80.0100.01217.85
7.4.70.0080.00816.48
7.4.60.0120.00616.56
7.4.50.0120.00816.39
7.4.40.0120.00816.28
7.4.30.0110.00816.47
7.4.20.0100.01016.38
7.4.10.0100.00916.14
7.4.00.0100.00915.90
7.3.330.0060.00013.37
7.3.320.0060.00013.39
7.3.310.0070.00016.42
7.3.300.0020.00516.27
7.3.290.0000.00816.32
7.3.280.0080.00916.29
7.3.270.0140.00317.40
7.3.260.0090.00816.72
7.3.250.0080.00916.55
7.3.240.0110.00616.51
7.3.230.0040.01216.53
7.3.210.0060.01216.69
7.3.200.0120.00816.40
7.3.190.0090.00816.44
7.3.180.0080.01116.37
7.3.170.0100.00916.42
7.3.160.0110.00916.22
7.3.150.0080.01016.32
7.3.140.0040.01416.53
7.3.130.0070.01116.08
7.3.120.0090.00916.02
7.3.110.0080.01016.09
7.3.100.0100.00916.09
7.3.90.0080.01116.16
7.3.80.0100.00816.20
7.3.70.0070.01216.09
7.3.60.0070.01016.08
7.3.50.0080.01016.12
7.3.40.0080.01016.04
7.3.30.0050.01416.06
7.3.20.0110.00816.81
7.3.10.0110.00616.82
7.3.00.0110.00816.76
7.2.330.0130.00316.63
7.2.320.0130.00616.73
7.2.310.0090.00916.63
7.2.300.0090.01116.74
7.2.290.0140.00616.58
7.2.280.0110.01016.69
7.2.270.0120.00816.54
7.2.260.0090.01116.45
7.2.250.0110.00916.30
7.2.240.0090.00816.31
7.2.230.0100.00916.39
7.2.220.0100.01016.25
7.2.210.0100.00916.37
7.2.200.0080.01116.28
7.2.190.0050.01416.34
7.2.180.0090.00816.32
7.2.170.0060.01316.31
7.2.160.0090.00816.30
7.2.150.0090.01117.20
7.2.140.0080.01417.17
7.2.130.0060.01317.10
7.2.120.0100.01017.00
7.2.110.0080.01117.09
7.2.100.0090.00917.14
7.2.90.0090.01117.05
7.2.80.0110.00717.02
7.2.70.0130.01022.90
7.2.60.0110.00617.07
7.2.50.0080.01117.07
7.2.40.0110.00917.10
7.2.30.0080.01217.12
7.2.20.0080.00917.13
7.2.10.0110.00917.10
7.2.00.0150.01017.24
7.1.330.0150.00816.07
7.1.320.0160.01016.06
7.1.310.0300.00915.93
7.1.300.0190.00816.05
7.1.290.0170.00815.95
7.1.280.0150.01115.98
7.1.270.0140.01115.95
7.1.260.0190.00815.91
7.1.250.0160.00815.96
7.1.240.0140.01016.00
7.1.230.0130.01215.92
7.1.220.0170.00715.95
7.1.210.0210.01015.95
7.1.200.0120.00915.92
7.1.190.0150.00915.93
7.1.180.0140.01015.78
7.1.170.0180.00715.95
7.1.160.0140.01015.97
7.1.150.0140.00815.89
7.1.140.0170.00815.95
7.1.130.0130.01015.90
7.1.120.0180.01116.14
7.1.110.0150.00915.96
7.1.100.0190.00715.96
7.1.90.0440.01116.23
7.1.80.0150.00916.23
7.1.70.0180.00915.98
7.1.60.0170.01022.69
7.1.50.0180.01022.56
7.1.40.0190.00922.44
7.1.30.0190.01222.49
7.1.20.0170.01222.54
7.1.10.0150.00915.75
7.1.00.0180.00615.79
7.0.330.0150.00633.79
7.0.320.0180.00915.58
7.0.310.0160.01015.58
7.0.300.0150.00915.54
7.0.290.0130.01315.67
7.0.280.0130.00915.64
7.0.270.0280.00915.70
7.0.260.0170.00915.83
7.0.250.0170.00715.68
7.0.240.0160.00815.69
7.0.230.0160.01015.94
7.0.220.0450.00815.92
7.0.210.0150.00915.56
7.0.200.0170.00815.55
7.0.190.0140.00915.57
7.0.180.0180.00815.43
7.0.170.0180.00815.47
7.0.160.0140.01015.45
7.0.150.0140.00815.38
7.0.140.0150.01015.39
7.0.130.0140.00915.57
7.0.120.0120.01115.55
7.0.110.0120.01115.46
7.0.100.0120.00915.49
7.0.90.0130.00915.49
7.0.80.0110.01015.46
7.0.70.0140.00915.45
7.0.60.0130.00915.43
7.0.50.0430.00815.48
7.0.40.0190.00915.19
7.0.30.0140.00815.31
7.0.20.0140.00915.21
7.0.10.0150.00915.24
7.0.00.0150.00915.26
5.6.400.0140.01015.75
5.6.390.0170.00715.78
5.6.380.0170.00815.72
5.6.370.0150.01015.54
5.6.360.0160.00915.79
5.6.350.0170.00915.70
5.6.340.0130.01115.63
5.6.330.0130.01315.74
5.6.320.0150.01015.69
5.6.310.0130.01215.57
5.6.300.0150.03117.64
5.6.290.0140.02717.68
5.6.280.0130.02817.64
5.6.270.0090.03317.67
5.6.260.0130.02917.68
5.6.250.0130.02817.60
5.6.240.0130.02917.62
5.6.230.0140.03017.63
5.6.220.0160.02617.59
5.6.210.0160.02517.56
5.6.200.0140.02917.56
5.6.190.0150.02817.61
5.6.180.0140.02817.60
5.6.170.0140.02717.60
5.6.160.0150.02917.55
5.6.150.0120.03117.64
5.6.140.0130.02817.62
5.6.130.0150.02717.62
5.6.120.0140.03017.71
5.6.110.0130.03117.65
5.6.100.0120.03017.59
5.6.90.0140.03117.56
5.6.80.0100.03117.36
5.6.70.0130.02717.32
5.6.60.0120.02917.32
5.6.50.0160.02517.30
5.6.40.0160.02517.32
5.6.30.0160.02617.39
5.6.20.0120.03017.34
5.6.10.0130.02817.33
5.6.00.0160.02517.31
5.5.380.0170.02516.59
5.5.370.0140.03016.57
5.5.360.0170.03316.59
5.5.350.0170.02716.52
5.5.340.0120.03216.76
5.5.330.0180.02716.61
5.5.320.0170.03016.78
5.5.310.0140.03016.70
5.5.300.0170.02816.75
5.5.290.0160.02816.77
5.5.280.0170.03116.80
5.5.270.0160.03216.63
5.5.260.0160.03516.77
5.5.250.0210.03016.70
5.5.240.0180.02616.42
5.5.230.0140.03016.47
5.5.220.0200.02616.45
5.5.210.0180.02516.53
5.5.200.0130.03116.42
5.5.190.0170.03116.42
5.5.180.0150.03116.46
5.5.170.0160.01315.94
5.5.160.0160.02816.47
5.5.150.0130.03116.46
5.5.140.0150.03016.52
5.5.130.0140.02916.54
5.5.120.0150.02716.41
5.5.110.0130.03116.33
5.5.100.0150.02916.39
5.5.90.0150.02616.36
5.5.80.0170.02616.38
5.5.70.0130.03516.42
5.5.60.0120.03416.39
5.5.50.0130.03316.50
5.5.40.0160.02616.32
5.5.30.0100.03116.36
5.5.20.0120.03216.40
5.5.10.0130.02716.38
5.5.00.0130.03116.35
5.4.450.0130.03215.50
5.4.440.0140.02815.47
5.4.430.0140.02415.49
5.4.420.0130.02715.55
5.4.410.0140.02615.52
5.4.400.0130.02515.48
5.4.390.0100.03115.41
5.4.380.0110.02815.41
5.4.370.0120.02615.40
5.4.360.0140.03115.32
5.4.350.0090.03015.36
5.4.340.0080.03415.34
5.4.330.0110.00912.99
5.4.320.0140.02815.45
5.4.310.0100.02915.29
5.4.300.0100.02815.40
5.4.290.0120.02515.37
5.4.280.0090.02815.40
5.4.270.0100.03015.32
5.4.260.0140.02615.32
5.4.250.0150.02315.31
5.4.240.0130.03215.33
5.4.230.0130.02815.36
5.4.220.0110.03215.38
5.4.210.0170.02415.34
5.4.200.0120.02415.40
5.4.190.0120.02615.36
5.4.180.0110.02615.39
5.4.170.0130.02715.36
5.4.160.0150.02315.33
5.4.150.0120.02815.38
5.4.140.0110.02814.41
5.4.130.0130.02414.43
5.4.120.0090.02614.42
5.4.110.0120.02714.45
5.4.100.0110.02614.38
5.4.90.0120.02414.46
5.4.80.0090.02514.38
5.4.70.0110.02414.42
5.4.60.0140.03114.39
5.4.50.0110.02614.44
5.4.40.0090.02514.38
5.4.30.0110.02414.41
5.4.20.0110.02614.37
5.4.10.0130.02414.44
5.4.00.0100.02714.16
5.3.290.0090.02813.88
5.3.280.0120.03213.80
5.3.270.0130.02513.81
5.3.260.0140.02613.70
5.3.250.0090.03013.90
5.3.240.0140.02213.82
5.3.230.0110.02713.77
5.3.220.0140.02313.75
5.3.210.0120.02613.79
5.3.200.0100.02513.79
5.3.190.0110.02913.84
5.3.180.0080.02713.89
5.3.170.0100.02713.85
5.3.160.0130.02313.89
5.3.150.0110.02613.85
5.3.140.0110.02413.84
5.3.130.0100.02713.83
5.3.120.0110.02513.82
5.3.110.0140.02413.78
5.3.100.0130.02613.60
5.3.90.0120.02413.55
5.3.80.0080.03113.49
5.3.70.0110.02713.50
5.3.60.0130.02313.58
5.3.50.0090.02713.57
5.3.40.0100.02513.51
5.3.30.0080.02913.61
5.3.20.0120.02613.45
5.3.10.0100.02413.38
5.3.00.0200.02713.35
5.2.170.0090.02312.03
5.2.160.0080.02312.05
5.2.150.0090.02111.98
5.2.140.0120.02112.07
5.2.130.0110.02212.00
5.2.120.0090.01911.97
5.2.110.0120.02112.01
5.2.100.0140.02111.92
5.2.90.0080.02412.02
5.2.80.0100.02011.92
5.2.70.0080.02311.98
5.2.60.0100.02111.92
5.2.50.0100.02011.87
5.2.40.0090.02011.95
5.2.30.0080.02311.87
5.2.20.0110.01811.82
5.2.10.0110.01811.81
5.2.00.0060.02311.77
5.1.60.0080.01811.50
5.1.50.0090.01911.48
5.1.40.0100.01511.42
5.1.30.0100.01911.64
5.1.20.0080.02111.60
5.1.10.0090.02111.51
5.1.00.0080.02011.44
5.0.50.0100.01411.08
5.0.40.0070.01511.08
5.0.30.0060.02111.08
5.0.20.0130.01311.08
5.0.10.0060.01611.08
5.0.00.0060.02311.08
4.4.90.0050.01011.08
4.4.80.0020.01411.08
4.4.70.0060.00911.08
4.4.60.0040.01211.08
4.4.50.0050.01111.08
4.4.40.0060.01511.08
4.4.30.0060.01011.08
4.4.20.0050.01111.08
4.4.10.0030.01311.08
4.4.00.0060.01611.08
4.3.110.0050.01511.08
4.3.100.0090.00911.08
4.3.90.0070.00911.08
4.3.80.0070.01611.08
4.3.70.0050.01211.08
4.3.60.0060.01111.08
4.3.50.0060.01011.08
4.3.40.0050.01611.08
4.3.30.0050.01211.08
4.3.20.0070.00911.08
4.3.10.0060.00911.08
4.3.00.0040.01111.08

preferences:
38.23 ms | 403 KiB | 5 Q