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, $component, 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 & $flag) { $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.60.0120.00916.72
8.3.50.0140.00522.16
8.3.40.0110.00418.70
8.3.30.0090.00919.27
8.3.20.0080.00020.19
8.3.10.0040.00423.52
8.3.00.0050.00321.00
8.2.180.0090.00616.88
8.2.170.0120.00322.96
8.2.160.0150.00020.32
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0020.00526.16
8.2.120.0000.01120.80
8.2.110.0090.00019.27
8.2.100.0040.00718.03
8.2.90.0040.00419.38
8.2.80.0040.00417.97
8.2.70.0000.00917.75
8.2.60.0050.00517.93
8.2.50.0040.00418.07
8.2.40.0080.00018.20
8.2.30.0000.00719.46
8.2.20.0040.00417.83
8.2.10.0000.00818.18
8.2.00.0030.00617.71
8.1.280.0080.00625.92
8.1.270.0000.00823.87
8.1.260.0030.00626.35
8.1.250.0070.00728.09
8.1.240.0080.00022.57
8.1.230.0090.00320.97
8.1.220.0080.00018.77
8.1.210.0080.00019.02
8.1.200.0070.00317.22
8.1.190.0000.00917.51
8.1.180.0080.00018.10
8.1.170.0060.00318.59
8.1.160.0050.00318.91
8.1.150.0040.00418.67
8.1.140.0050.00317.48
8.1.130.0030.00517.71
8.1.120.0030.00317.35
8.1.110.0000.00717.48
8.1.100.0040.00417.53
8.1.90.0040.00417.41
8.1.80.0000.00817.47
8.1.70.0070.00017.49
8.1.60.0040.00417.52
8.1.50.0040.00417.45
8.1.40.0040.00417.59
8.1.30.0030.00517.64
8.1.20.0040.00417.69
8.1.10.0040.00417.58
8.1.00.0060.00317.53
8.0.300.0060.00320.00
8.0.290.0000.00716.91
8.0.280.0030.00318.47
8.0.270.0040.00416.89
8.0.260.0030.00317.19
8.0.250.0040.00417.06
8.0.240.0000.00717.01
8.0.230.0070.00016.98
8.0.220.0070.00017.02
8.0.210.0070.00016.96
8.0.200.0030.00317.06
8.0.190.0050.00317.05
8.0.180.0000.00717.00
8.0.170.0060.00316.90
8.0.160.0000.00717.00
8.0.150.0030.00516.96
8.0.140.0040.00416.88
8.0.130.0040.00413.34
8.0.120.0000.00816.94
8.0.110.0000.00817.02
8.0.100.0070.00016.77
8.0.90.0040.00416.93
8.0.80.0080.01216.96
8.0.70.0040.00416.87
8.0.60.0000.00717.00
8.0.50.0050.00217.03
8.0.30.0110.00817.16
8.0.20.0110.00817.40
8.0.10.0000.00817.08
8.0.00.0110.00916.76
7.4.330.0050.00015.00
7.4.320.0030.00316.59
7.4.300.0060.00016.53
7.4.290.0030.00316.52
7.4.280.0000.00816.50
7.4.270.0020.00516.48
7.4.260.0050.00216.41
7.4.250.0000.00816.52
7.4.240.0030.00416.57
7.4.230.0000.00716.51
7.4.220.0100.01016.56
7.4.210.0100.01016.56
7.4.200.0070.00016.53
7.4.190.0000.00716.42
7.4.160.0080.00816.54
7.4.150.0140.00717.40
7.4.140.0110.00817.86
7.4.130.0070.01316.60
7.4.120.0120.00916.57
7.4.110.0060.01216.64
7.4.100.0110.00616.58
7.4.90.0140.00316.58
7.4.80.0090.00919.39
7.4.70.0040.01216.61
7.4.60.0060.01216.56
7.4.50.0000.00816.59
7.4.40.0110.00616.64
7.4.30.0140.00316.64
7.4.10.0060.01014.79
7.4.00.0110.00714.91
7.3.330.0020.00313.27
7.3.320.0000.00613.38
7.3.310.0000.00716.45
7.3.300.0030.00316.32
7.3.290.0110.00416.41
7.3.280.0120.00616.37
7.3.270.0030.01317.40
7.3.260.0100.00716.66
7.3.250.0030.01416.56
7.3.240.0030.01416.64
7.3.230.0150.00716.64
7.3.210.0090.00916.43
7.3.200.0150.00819.39
7.3.190.0040.01216.45
7.3.180.0100.00616.59
7.3.170.0090.00616.40
7.3.160.0130.01016.65
7.3.130.0070.00715.15
7.3.120.0080.00714.85
7.3.110.0050.01114.88
7.3.100.0070.00715.00
7.3.90.0080.00814.90
7.3.80.0090.00314.94
7.3.70.0040.01014.72
7.3.60.0030.00814.90
7.3.50.0100.00315.00
7.3.40.0060.00614.95
7.3.30.0070.00314.83
7.3.20.0060.00616.75
7.3.10.0020.01116.67
7.3.00.0050.00716.74
7.2.330.0130.00616.83
7.2.320.0130.01016.68
7.2.310.0090.00916.84
7.2.300.0030.01316.73
7.2.290.0190.00016.79
7.2.260.0090.00915.27
7.2.250.0060.00915.07
7.2.240.0050.01115.14
7.2.230.0080.00915.10
7.2.220.0050.01015.28
7.2.210.0050.01114.98
7.2.200.0040.00915.21
7.2.190.0030.01215.14
7.2.180.0080.00814.91
7.2.170.0020.01115.16
7.2.160.0000.00915.30
7.2.150.0110.00717.00
7.2.140.0110.00716.82
7.2.130.0060.00716.89
7.2.120.0070.00716.96
7.2.110.0080.00617.01
7.2.100.0040.01117.00
7.2.90.0070.00616.95
7.2.80.0020.01116.86
7.2.70.0030.01016.88
7.2.60.0040.01017.07
7.2.50.0100.00616.92
7.2.40.0070.00516.98
7.2.30.0010.00817.09
7.2.20.0050.00616.91
7.2.10.0020.01116.96
7.2.00.0070.01017.84
7.1.330.0020.01115.76
7.1.320.0060.00515.90
7.1.310.0050.01015.63
7.1.300.0050.00515.69
7.1.290.0030.01315.72
7.1.280.0030.01015.77
7.1.270.0030.01015.82
7.1.260.0080.00715.85
7.1.250.0090.00415.87
7.1.240.0000.01715.63
7.1.230.0030.01415.68
7.1.220.0030.01315.91
7.1.210.0100.00315.76
7.1.200.0030.00815.74
7.1.190.0040.01115.89
7.1.180.0030.00915.65
7.1.170.0110.00015.56
7.1.160.0090.00615.71
7.1.150.0030.00715.87
7.1.140.0110.00315.83
7.1.130.0060.00315.97
7.1.120.0040.01515.82
7.1.110.0040.01515.87
7.1.100.0030.01116.90
7.1.90.0100.00315.85
7.1.80.0090.00615.82
7.1.70.0040.00716.52
7.1.60.0070.00817.63
7.1.50.0030.01316.42
7.1.40.0090.00615.83
7.1.30.0100.00315.71
7.1.20.0000.01115.65
7.1.10.0000.01315.54
7.1.00.0100.04818.95
7.0.330.0070.00715.48
7.0.320.0070.01015.12
7.0.310.0000.00915.60
7.0.300.0030.01515.44
7.0.290.0030.01015.46
7.0.280.0030.00915.51
7.0.270.0070.01015.43
7.0.260.0000.01515.46
7.0.250.0060.00315.43
7.0.240.0060.00615.50
7.0.230.0040.00415.48
7.0.220.0070.00715.14
7.0.210.0090.00615.61
7.0.200.0000.00916.04
7.0.190.0100.00315.13
7.0.180.0080.00815.47
7.0.170.0040.00415.33
7.0.160.0000.01115.46
7.0.150.0030.00615.29
7.0.140.0050.04018.65
7.0.130.0060.00315.65
7.0.120.0070.00715.64
7.0.110.0100.00315.57
7.0.100.0070.00715.59
7.0.90.0060.00615.54
7.0.80.0070.03717.52
7.0.70.0090.02017.76
7.0.60.0050.02517.75
7.0.50.0070.02318.00
7.0.40.0070.04216.86
7.0.30.0050.03216.71
7.0.20.0030.02616.80
7.0.10.0080.02316.78
7.0.00.0050.03016.81
5.6.400.0070.00714.82
5.6.390.0090.00614.46
5.6.380.0040.00814.62
5.6.370.0090.00614.58
5.6.360.0030.01014.12
5.6.350.0050.00514.50
5.6.340.0120.00414.44
5.6.330.0030.00914.72
5.6.320.0000.01414.48
5.6.310.0050.00514.58
5.6.300.0030.00614.44
5.6.290.0070.00714.51
5.6.280.0000.04517.86
5.6.270.0030.01214.33
5.6.260.0040.01114.68
5.6.250.0030.00914.46
5.6.240.0030.00814.76
5.6.230.0080.03217.47
5.6.220.0110.03517.56
5.6.210.0020.02917.54
5.6.200.0030.03817.64
5.6.190.0000.03117.89
5.6.180.0090.03617.94
5.6.170.0020.02817.93
5.6.160.0050.02317.74
5.6.150.0090.02817.89
5.6.140.0110.02217.71
5.6.130.0050.03217.78
5.6.120.0040.02617.69
5.6.110.0080.02417.82
5.6.100.0070.02217.74
5.6.90.0050.02617.77
5.6.80.0120.03517.53
5.6.70.0070.02417.31
5.6.60.0060.04317.29
5.6.50.0070.02417.42
5.6.40.0030.04617.43
5.6.30.0110.02317.36
5.6.20.0110.04117.47
5.6.10.0110.03817.44
5.6.00.0050.04117.43
5.5.380.0080.00814.45
5.5.370.0070.02217.41
5.5.360.0060.02517.34
5.5.350.0080.02617.26
5.5.340.0000.03317.81
5.5.330.0100.02017.58
5.5.320.0050.04517.43
5.5.310.0020.03017.76
5.5.300.0020.02917.79
5.5.290.0080.03017.52
5.5.280.0030.02817.43
5.5.270.0070.04417.69
5.5.260.0100.02317.62
5.5.250.0120.03017.33
5.5.240.0060.04017.24
5.5.230.0080.04417.33
5.5.220.0040.02317.15
5.5.210.0100.04017.21
5.5.200.0080.03917.17
5.5.190.0150.02817.24
5.5.180.0080.04517.24
5.5.170.0030.00614.47
5.5.160.0120.03917.35
5.5.150.0030.04717.11
5.5.140.0070.04317.10
5.5.130.0050.03617.34
5.5.120.0080.04317.16
5.5.110.0110.03917.36
5.5.100.0150.04017.11
5.5.90.0090.04117.05
5.5.80.0050.04017.20
5.5.70.0090.03717.15
5.5.60.0070.04216.96
5.5.50.0080.03517.26
5.5.40.0030.04517.20
5.5.30.0100.02817.10
5.5.20.0050.04217.29
5.5.10.0050.04817.14
5.5.00.0100.04117.22
5.4.450.0000.02715.91
5.4.440.0030.02715.89
5.4.430.0020.02716.06
5.4.420.0080.02216.05
5.4.410.0020.02715.92
5.4.400.0090.02515.83
5.4.390.0070.04215.91
5.4.380.0070.04015.83
5.4.370.0050.04715.88
5.4.360.0050.03915.73
5.4.350.0080.03715.87
5.4.340.0000.04515.76
5.4.330.0030.00612.62
5.4.320.0130.03015.82
5.4.310.0080.02815.78
5.4.300.0020.04115.82
5.4.290.0050.04315.80
5.4.280.0030.04015.92
5.4.270.0080.03515.92
5.4.260.0030.03615.83
5.4.250.0080.03715.83
5.4.240.0000.04815.78
5.4.230.0030.04115.76
5.4.220.0070.04215.92
5.4.210.0100.03515.74
5.4.200.0030.04315.88
5.4.190.0070.03815.84
5.4.180.0070.04115.82
5.4.170.0090.02815.85
5.4.160.0110.03615.81
5.4.150.0070.04115.82
5.4.140.0050.03514.50
5.4.130.0000.03514.58
5.4.120.0080.03514.50
5.4.110.0100.03314.59
5.4.100.0050.04014.52
5.4.90.0100.03314.47
5.4.80.0050.03214.54
5.4.70.0060.03014.52
5.4.60.0050.02514.49
5.4.50.0080.03414.46
5.4.40.0050.04014.50
5.4.30.0120.03514.47
5.4.20.0060.03514.46
5.4.10.0050.04414.48
5.4.00.0060.03314.26
5.3.290.0080.04013.62
5.3.280.0080.03313.63
5.3.270.0060.03513.58
5.3.260.0080.02413.68
5.3.250.0070.04013.66
5.3.240.0020.04113.60
5.3.230.0030.04413.65
5.3.220.0070.04013.56
5.3.210.0070.03913.61
5.3.200.0060.03013.62
5.3.190.0030.03613.66
5.3.180.0070.03013.62
5.3.170.0060.02913.60
5.3.160.0030.04213.60
5.3.150.0080.03313.57
5.3.140.0080.03213.64
5.3.130.0090.03813.54
5.3.120.0070.04313.65
5.3.110.0060.03113.65
5.3.100.0190.03013.38
5.3.90.0070.03713.36
5.3.80.0030.04113.33
5.3.70.0030.03713.33
5.3.60.0050.04013.25
5.3.50.0100.02713.31
5.3.40.0050.04513.25
5.3.30.0070.03513.22
5.3.20.0050.02413.10
5.3.10.0030.02613.10
5.3.00.0030.04313.15
5.2.170.0070.06311.70
5.2.160.0130.05011.70
5.2.150.0100.05711.70
5.2.140.0030.04311.70
5.2.130.0100.05011.70
5.2.120.0100.05011.70
5.2.110.0030.06011.70
5.2.100.0000.04011.70
5.2.90.0030.03011.70
5.2.80.0030.06011.70
5.2.70.0170.05011.70
5.2.60.0200.05311.70
5.2.50.0170.05311.70
5.2.40.0130.05311.70
5.2.30.0100.06011.70
5.2.20.0100.06311.70
5.2.10.0030.06011.70
5.2.00.0000.05311.70
5.1.60.0100.04711.70
5.1.50.0100.03311.70
5.1.40.0030.05011.70
5.1.30.0070.03711.70
5.1.20.0100.04311.70
5.1.10.0070.05011.70
5.1.00.0070.05711.70
5.0.50.0070.03011.70
5.0.40.0000.02311.70
5.0.30.0070.05011.70
5.0.20.0030.04011.70
5.0.10.0000.02711.70
5.0.00.0030.05011.70
4.4.90.0070.03311.70
4.4.80.0070.03011.70
4.4.70.0070.03311.70
4.4.60.0000.03011.70
4.4.50.0000.03011.70
4.4.40.0030.05711.70
4.4.30.0030.02711.70
4.4.20.0000.03711.70
4.4.10.0030.03311.70
4.4.00.0000.03311.70
4.3.110.0030.02711.70
4.3.100.0130.02311.70
4.3.90.0000.02311.70
4.3.80.0000.04711.70
4.3.70.0100.02011.70
4.3.60.0000.03711.70
4.3.50.0000.03011.70
4.3.40.0000.04011.70
4.3.30.0000.03011.70
4.3.20.0000.03711.70
4.3.10.0000.02711.70
4.3.00.0030.03311.70

preferences:
47.96 ms | 400 KiB | 5 Q