3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Because PHP_URL_* constants are sequential :-( const URL_SCHEME = 0x01; const URL_USER = 0x02; const URL_PASS = 0x04; const URL_HOST = 0x08; const URL_PORT = 0x10; const URL_PATH = 0x20; const URL_QUERY = 0x40; const URL_FRAGMENT = 0x80; function url_replace($url, $components, callable $callback) { $map = [ URL_SCHEME => 'scheme', URL_USER => 'user', URL_PASS => 'pass', URL_HOST => 'host', URL_PORT => 'port', URL_PATH => 'path', URL_QUERY => 'query', URL_FRAGMENT => 'fragment', ]; if (!$parts = parse_url($url)) { return $url; } foreach ($map as $component => $key) { if ($components & $component) { $parts[$key] = $callback($parts[$key], $component); } } $result = ''; if (isset($parts['scheme'])) { $result = $parts['scheme'] . ':'; } if (isset($parts['host'])) { $result .= '//'; if (isset($parts['user'])) { $result .= $parts['user']; if (isset($parts['pass'])) { $result .= ':' . $parts['pass']; } $result .= '@'; } $result .= $parts['host']; if (isset($parts['port'])) { $result .= ':' . $parts['port']; } } if (isset($parts['path'])) { $result .= $parts['path']; } if (isset($parts['query'])) { $result .= '?' . $parts['query']; } if (isset($parts['fragment'])) { $result .= '#' . $parts['fragment']; } return $result; } $url = 'http://test.com/test-one,two three?a=b#bla'; echo url_replace($url, URL_PATH, function($path) { return '/foobar'; });

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.40.0100.00718.90
8.3.30.0100.00319.21
8.3.20.0040.00420.21
8.3.10.0000.00823.70
8.3.00.0080.00019.25
8.2.170.0140.00022.96
8.2.160.0100.00320.38
8.2.150.0020.00524.18
8.2.140.0060.00324.66
8.2.130.0110.00426.16
8.2.120.0080.00022.27
8.2.110.0030.00722.21
8.2.100.0060.00617.97
8.2.90.0000.00818.22
8.2.80.0080.00017.97
8.2.70.0000.00817.50
8.2.60.0040.00418.05
8.2.50.0080.00018.07
8.2.40.0080.00018.03
8.2.30.0040.00418.03
8.2.20.0030.00517.85
8.2.10.0070.00018.09
8.2.00.0030.00617.66
8.1.270.0030.00622.10
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0060.01024.00
8.1.230.0110.00020.97
8.1.220.0030.00617.76
8.1.210.0090.00018.97
8.1.200.0030.00617.38
8.1.190.0080.00017.53
8.1.180.0050.00318.10
8.1.170.0050.00318.50
8.1.160.0000.00722.08
8.1.150.0040.00418.66
8.1.140.0040.00417.53
8.1.130.0070.00017.79
8.1.120.0040.00417.48
8.1.110.0000.00717.45
8.1.100.0050.00217.50
8.1.90.0040.00417.40
8.1.80.0000.00717.44
8.1.70.0030.00317.39
8.1.60.0060.00317.63
8.1.50.0040.00417.53
8.1.40.0040.00417.55
8.1.30.0040.00417.66
8.1.20.0030.00617.59
8.1.10.0040.00417.50
8.1.00.0040.00417.50
8.0.300.0000.00720.16
8.0.290.0000.00717.18
8.0.280.0070.00018.60
8.0.270.0030.00317.21
8.0.260.0040.00416.83
8.0.250.0050.00316.97
8.0.240.0000.00716.91
8.0.230.0040.00416.95
8.0.220.0030.00317.00
8.0.210.0030.00316.85
8.0.200.0000.00816.94
8.0.190.0000.00817.04
8.0.180.0040.00416.89
8.0.170.0000.00816.98
8.0.160.0080.00016.90
8.0.150.0050.00216.88
8.0.140.0030.00616.93
8.0.130.0000.00513.41
8.0.120.0040.00416.96
8.0.110.0020.00516.96
8.0.100.0050.00217.01
8.0.90.0050.00316.93
8.0.80.0000.01417.03
8.0.70.0040.00416.79
8.0.60.0000.00716.77
8.0.50.0000.00717.04
8.0.30.0070.01516.96
8.0.20.0070.01517.40
8.0.10.0050.00317.15
8.0.00.0100.00816.77
7.4.330.0060.00015.00
7.4.320.0030.00316.53
7.4.300.0030.00316.54
7.4.290.0000.00916.66
7.4.280.0060.00316.65
7.4.270.0030.00316.59
7.4.260.0030.00316.65
7.4.250.0030.00516.59
7.4.240.0020.00516.58
7.4.230.0060.00016.43
7.4.220.0100.01416.56
7.4.210.0050.01016.49
7.4.200.0030.00316.48
7.4.190.0050.00316.49
7.4.160.0060.01116.59
7.4.150.0090.00917.40
7.4.140.0070.01017.86
7.4.130.0100.00716.58
7.4.120.0080.00916.56
7.4.110.0090.00916.60
7.4.100.0060.01216.54
7.4.90.0130.00316.50
7.4.80.0090.01019.39
7.4.70.0110.00616.43
7.4.60.0030.01316.48
7.4.50.0030.00616.72
7.4.40.0030.00622.77
7.4.30.0150.00016.46
7.4.00.0090.00914.99
7.3.330.0030.00213.41
7.3.320.0020.00213.41
7.3.310.0040.00416.42
7.3.300.0000.00616.43
7.3.290.0070.00716.33
7.3.280.0080.01016.40
7.3.270.0130.00317.40
7.3.260.0090.00916.55
7.3.250.0100.01116.52
7.3.240.0130.01016.68
7.3.230.0080.00816.47
7.3.210.0040.01416.31
7.3.200.0090.01219.39
7.3.190.0060.01216.58
7.3.180.0090.00616.52
7.3.170.0030.01316.49
7.3.160.0090.00616.30
7.3.120.0030.01414.89
7.2.330.0060.01216.77
7.2.320.0160.01216.64
7.2.310.0100.01016.75
7.2.300.0120.00616.86
7.2.290.0090.00916.82
7.2.00.0060.00619.50
7.1.100.0060.00618.14
7.1.70.0060.00317.33
7.1.60.0100.01419.33
7.1.50.0120.00917.05
7.1.00.0000.08022.43
7.0.200.0070.00316.79
7.0.140.0070.07021.99
7.0.100.0070.07320.11
7.0.90.0130.07719.93
7.0.80.0100.06720.00
7.0.70.0070.07720.07
7.0.60.0100.06720.01
7.0.50.0030.08320.39
7.0.40.0130.08020.01
7.0.30.0030.07720.18
7.0.20.0100.08320.18
7.0.10.0130.07720.18
7.0.00.0100.07020.02
5.6.280.0070.06721.12
5.6.250.0030.08320.79
5.6.240.0130.05320.78
5.6.230.0130.06720.65
5.6.220.0030.08020.63
5.6.210.0070.07720.68
5.6.200.0130.08021.06
5.6.190.0030.05721.13
5.6.180.0130.08320.96
5.6.170.0070.05021.10
5.6.160.0070.08721.07
5.6.150.0130.06321.20
5.6.140.0070.05021.04
5.6.130.0070.08721.19
5.6.120.0070.08021.07
5.6.110.0030.05321.10
5.6.100.0070.04721.18
5.6.90.0030.04321.06
5.6.80.0070.03720.43
5.6.70.0100.04020.41
5.6.60.0070.04020.50
5.6.50.0030.05020.40
5.6.40.0000.07020.49
5.6.30.0100.07320.35
5.6.20.0100.06320.36
5.6.10.0100.07720.48
5.6.00.0030.03720.50
5.5.380.0070.08020.43
5.5.370.0130.05720.41
5.5.360.0070.08720.42
5.5.350.0070.08320.34
5.5.340.0070.06320.88
5.5.330.0100.07720.95
5.5.320.0030.06320.66
5.5.310.0000.08320.93
5.5.300.0130.08020.85
5.5.290.0170.08020.94
5.5.280.0070.09020.77
5.5.270.0030.07320.92
5.5.260.0100.03720.74
5.5.250.0100.04020.60
5.5.240.0070.03720.32
5.5.230.0000.04320.16
5.5.220.0170.03020.27
5.5.210.0030.04020.15
5.5.200.0030.08020.13
5.5.190.0100.08020.14
5.5.180.0000.08320.27
5.5.160.0100.06020.01
5.5.150.0000.04320.23
5.5.140.0100.06320.27
5.5.130.0070.04020.17
5.5.120.0070.05020.24
5.5.110.0000.04020.23
5.5.100.0030.04019.96
5.5.90.0130.03720.16
5.5.80.0030.03720.19
5.5.70.0100.03320.07
5.5.60.0030.04720.02
5.5.50.0000.05320.17
5.5.40.0030.03720.08
5.5.30.0030.03719.98
5.5.20.0030.03720.10
5.5.10.0030.05020.13
5.5.00.0070.04320.01
5.4.450.0130.06719.54
5.4.440.0030.07319.45
5.4.430.0070.04319.46
5.4.420.0030.04319.36
5.4.410.0030.04019.14
5.4.400.0070.04019.05
5.4.390.0030.04319.18
5.4.380.0070.03319.18
5.4.370.0070.05018.95
5.4.360.0070.05018.90
5.4.350.0000.03719.18
5.4.340.0070.03719.18
5.4.320.0030.07018.90
5.4.310.0070.03019.05
5.4.300.0030.04019.12
5.4.290.0030.04019.23
5.4.280.0070.03319.13
5.4.270.0030.05019.15
5.4.260.0000.04019.18
5.4.250.0130.02319.08
5.4.240.0030.04719.08
5.4.230.0000.04018.84
5.4.220.0130.03019.04
5.4.210.0100.03019.20
5.4.200.0030.06719.15
5.4.190.0070.03319.12
5.4.180.0070.03318.84
5.4.170.0070.04319.13
5.4.160.0130.04018.88
5.4.150.0030.03718.85
5.4.140.0030.03716.30
5.4.130.0000.04016.39
5.4.120.0030.04016.39
5.4.110.0130.02316.54
5.4.100.0000.04716.45
5.4.90.0070.05016.39
5.4.80.0100.05716.55
5.4.70.0070.06016.38
5.4.60.0070.06016.48
5.4.50.0100.07016.36
5.4.40.0070.07016.52
5.4.30.0030.07716.40
5.4.20.0070.05716.33
5.4.10.0070.08016.30
5.4.00.0030.07715.94
5.3.290.0130.05714.73
5.3.280.0000.04014.68
5.3.270.0030.03714.62
5.3.260.0000.07014.66
5.3.250.0070.03014.66
5.3.240.0100.03014.66
5.3.230.0030.04014.59
5.3.220.0030.04314.66
5.3.210.0000.07014.62
5.3.200.0070.05314.57
5.3.190.0030.07014.68
5.3.180.0030.06314.59
5.3.170.0170.06314.61
5.3.160.0030.07314.67
5.3.150.0030.07014.53
5.3.140.0100.07314.48
5.3.130.0100.04014.66
5.3.120.0030.07714.57
5.3.110.0030.06314.49
5.3.100.0030.04314.03
5.3.90.0030.03714.00
5.3.80.0070.06314.16
5.3.70.0030.08014.16
5.3.60.0070.06714.15
5.3.50.0100.06714.08
5.3.40.0070.07313.94
5.3.30.0100.07014.02
5.3.20.0030.04313.78
5.3.10.0070.07013.68
5.3.00.0130.06313.57
5.2.170.0070.06312.36
5.2.160.0070.05012.36
5.2.150.0070.03312.36
5.2.140.0070.06712.36
5.2.130.0030.03712.36
5.2.120.0100.05712.36
5.2.110.0070.03012.36
5.2.100.0000.06312.36
5.2.90.0070.05712.36
5.2.80.0030.06312.36
5.2.70.0000.05012.36
5.2.60.0070.06712.36
5.2.50.0070.05312.36
5.2.40.0070.06312.36
5.2.30.0100.05712.36
5.2.20.0030.05312.36
5.2.10.0030.06012.36
5.2.00.0130.05312.36
5.1.60.0070.05012.36
5.1.50.0070.05012.36
5.1.40.0100.05312.36
5.1.30.0070.02712.36
5.1.20.0000.06312.36
5.1.10.0030.05712.36
5.1.00.0100.05012.36
5.0.50.0070.04012.36
5.0.40.0030.04312.36
5.0.30.0030.06712.36
5.0.20.0030.04712.36
5.0.10.0030.04712.36
5.0.00.0030.07312.36
4.4.90.0070.02712.36
4.4.80.0000.03712.36
4.4.70.0030.03312.36
4.4.60.0070.02312.36
4.4.50.0070.03312.36
4.4.40.0000.05012.36
4.4.30.0030.02012.36
4.4.20.0000.03312.36
4.4.10.0030.01712.36
4.4.00.0030.02712.36
4.3.110.0070.03012.36
4.3.100.0000.02712.36
4.3.90.0030.03312.36
4.3.80.0000.03012.36
4.3.70.0070.03012.36
4.3.60.0000.03312.36
4.3.50.0030.03312.36
4.3.40.0070.05312.36
4.3.30.0000.03312.36
4.3.20.0030.01712.36
4.3.10.0000.03712.36
4.3.00.0030.02712.36

preferences:
36.95 ms | 400 KiB | 5 Q