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 = 'sip:foo@example.com'; echo url_replace($url, URL_PATH, function($path) { return 'bar@example.com'; });

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.0090.00618.56
8.3.50.0080.00822.12
8.3.40.0120.00318.89
8.3.30.0120.00618.89
8.3.20.0050.00220.19
8.3.10.0000.00722.10
8.3.00.0080.00022.39
8.2.180.0120.00616.63
8.2.170.0100.00722.96
8.2.160.0140.00020.98
8.2.150.0120.00324.18
8.2.140.0070.00724.66
8.2.130.0050.00326.16
8.2.120.0080.00019.48
8.2.110.0100.00720.54
8.2.100.0060.00619.64
8.2.90.0000.00719.35
8.2.80.0080.00018.04
8.2.70.0060.00317.63
8.2.60.0080.00018.04
8.2.50.0030.00518.07
8.2.40.0060.00318.22
8.2.30.0040.00418.06
8.2.20.0070.00017.79
8.2.10.0050.00317.79
8.2.00.0000.00917.83
8.1.280.0070.00725.92
8.1.270.0000.00723.99
8.1.260.0060.00326.35
8.1.250.0080.00028.09
8.1.240.0060.00323.77
8.1.230.0040.00719.16
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0060.00317.47
8.1.190.0000.00817.41
8.1.180.0050.00318.10
8.1.170.0000.00918.53
8.1.160.0030.00622.01
8.1.150.0040.00418.71
8.1.140.0050.00317.52
8.1.130.0070.00017.85
8.1.120.0000.00717.53
8.1.110.0050.00317.47
8.1.100.0040.00317.38
8.1.90.0000.00717.48
8.1.80.0000.00717.39
8.1.70.0040.00417.38
8.1.60.0040.00417.52
8.1.50.0000.00817.54
8.1.40.0000.00717.54
8.1.30.0030.00617.65
8.1.20.0000.00917.58
8.1.10.0040.00417.66
8.1.00.0060.00317.45
8.0.300.0070.00018.77
8.0.290.0070.00017.18
8.0.280.0050.00218.33
8.0.270.0030.00317.29
8.0.260.0070.00016.85
8.0.250.0020.00517.07
8.0.240.0000.00817.00
8.0.230.0040.00417.04
8.0.220.0040.00416.89
8.0.210.0000.00716.98
8.0.200.0000.00717.01
8.0.190.0040.00417.08
8.0.180.0000.00717.00
8.0.170.0090.00016.83
8.0.160.0040.00416.90
8.0.150.0040.00416.96
8.0.140.0000.00816.80
8.0.130.0030.00313.45
8.0.120.0040.00416.86
8.0.110.0090.00016.97
8.0.100.0040.00416.92
8.0.90.0050.00316.84
8.0.80.0070.01017.02
8.0.70.0000.00716.80
8.0.60.0080.00017.04
8.0.50.0020.00517.04
8.0.30.0130.01117.21
8.0.20.0100.00917.40
8.0.10.0040.00416.96
8.0.00.0120.01016.78
7.4.330.0000.00515.00
7.4.320.0000.00816.62
7.4.300.0060.00016.48
7.4.290.0000.00716.58
7.4.280.0050.00316.42
7.4.270.0000.00716.55
7.4.260.0070.00016.59
7.4.250.0050.00216.50
7.4.240.0020.00516.65
7.4.230.0000.00716.60
7.4.220.0150.00916.53
7.4.210.0040.01016.59
7.4.200.0040.00416.63
7.4.190.0070.00016.50
7.4.160.0050.01016.34
7.4.150.0150.00417.40
7.4.140.0100.01017.86
7.4.130.0120.00816.66
7.4.120.0120.00616.56
7.4.110.0160.00816.51
7.4.100.0130.01216.46
7.4.90.0120.00916.75
7.4.80.0030.01319.39
7.4.70.0070.01016.59
7.4.60.0100.00716.59
7.4.50.0000.00616.34
7.4.40.0090.00622.77
7.4.30.0100.00616.47
7.4.10.0060.01315.13
7.4.00.0090.00815.15
7.3.330.0000.00513.26
7.3.320.0030.00313.43
7.3.310.0070.00016.29
7.3.300.0000.00716.33
7.3.290.0160.00016.30
7.3.280.0090.00816.40
7.3.270.0100.00717.40
7.3.260.0100.01016.37
7.3.250.0080.00916.46
7.3.240.0080.00816.52
7.3.230.0000.01616.39
7.3.210.0140.01016.55
7.3.200.0110.00719.39
7.3.190.0060.01616.52
7.3.180.0090.01216.21
7.3.170.0120.00416.54
7.3.160.0060.00916.59
7.3.130.0090.00914.71
7.3.120.0050.01214.89
7.3.110.0120.00614.92
7.3.100.0000.01614.91
7.3.90.0090.00615.04
7.3.80.0040.00414.90
7.3.70.0000.01514.63
7.3.60.0120.00614.92
7.3.50.0070.00714.86
7.3.40.0070.00414.87
7.3.30.0000.01015.00
7.3.20.0090.00316.86
7.3.10.0110.00316.74
7.3.00.0070.00716.76
7.2.330.0040.01516.83
7.2.320.0150.00816.69
7.2.310.0090.01316.45
7.2.300.0100.00716.66
7.2.290.0160.00616.81
7.2.260.0070.01014.96
7.2.250.0070.01015.01
7.2.240.0070.00715.11
7.2.230.0070.01015.38
7.2.220.0070.01015.21
7.2.210.0120.00015.24
7.2.200.0100.00315.24
7.2.190.0050.00815.25
7.2.180.0060.00315.05
7.2.170.0090.00615.25
7.2.160.0030.00715.00
7.2.150.0100.00617.02
7.2.140.0060.00917.00
7.2.130.0000.01216.85
7.2.120.0000.01416.89
7.2.110.0060.00917.01
7.2.100.0080.00516.76
7.2.90.0090.00316.84
7.2.80.0070.01116.99
7.2.70.0120.00316.62
7.2.60.0080.00816.87
7.2.50.0120.00317.11
7.2.40.0090.00616.65
7.2.30.0000.01916.99
7.2.20.0040.00817.02
7.2.10.0060.00616.75
7.2.00.0000.01318.26
7.1.330.0070.00716.10
7.1.320.0070.01016.05
7.1.310.0030.01215.68
7.1.300.0000.00915.77
7.1.290.0040.00415.81
7.1.280.0000.01315.86
7.1.270.0030.01215.79
7.1.260.0030.00915.77
7.1.250.0130.00315.87
7.1.240.0060.00715.64
7.1.230.0080.00015.89
7.1.220.0110.00315.80
7.1.210.0060.00615.88
7.1.200.0040.00715.70
7.1.190.0070.00715.83
7.1.180.0070.01015.62
7.1.170.0060.00615.96
7.1.160.0030.00615.88
7.1.150.0110.00415.84
7.1.140.0040.00815.72
7.1.130.0000.00815.85
7.1.120.0070.00715.81
7.1.110.0040.01215.67
7.1.100.0380.00915.86
7.1.90.0000.01415.85
7.1.80.0040.01115.64
7.1.70.0000.01116.51
7.1.60.0070.01217.71
7.1.50.0090.00816.22
7.1.40.0060.00316.08
7.1.30.0070.00715.84
7.1.20.0090.00615.76
7.1.10.0080.00415.71
7.1.00.0020.04319.07
7.0.330.0070.00715.24
7.0.320.0110.00415.45
7.0.310.0000.01115.43
7.0.300.0000.01115.42
7.0.290.0110.00415.26
7.0.280.0070.00715.43
7.0.270.0030.00715.20
7.0.260.0080.00415.30
7.0.250.0070.00715.54
7.0.240.0050.00515.51
7.0.230.0030.00615.21
7.0.220.0030.00915.23
7.0.210.0040.00415.19
7.0.200.0050.00715.94
7.0.190.0000.00815.51
7.0.180.0080.00415.61
7.0.170.0000.01215.21
7.0.160.0080.00315.53
7.0.150.0030.01015.33
7.0.140.0020.04218.81
7.0.130.0030.00715.64
7.0.120.0070.00715.60
7.0.110.0060.00915.30
7.0.100.0110.00015.52
7.0.90.0040.00415.53
7.0.80.0040.00715.63
7.0.70.0060.00615.46
7.0.60.0170.04317.72
7.0.50.0080.04316.72
7.0.40.0120.03816.73
7.0.30.0120.02816.82
7.0.20.0170.03516.69
7.0.10.0100.04516.92
7.0.00.0070.04816.78
5.6.400.0030.01014.00
5.6.390.0100.00714.56
5.6.380.0070.00314.51
5.6.370.0070.00314.13
5.6.360.0040.00714.11
5.6.350.0000.01214.60
5.6.340.0060.00914.71
5.6.330.0000.01114.61
5.6.320.0030.00614.74
5.6.310.0080.00514.57
5.6.300.0100.00314.39
5.6.290.0000.01114.29
5.6.280.0020.04017.86
5.6.270.0050.00514.55
5.6.260.0070.00714.44
5.6.250.0040.01214.44
5.6.240.0090.00614.47
5.6.230.0030.01314.66
5.6.220.0080.00814.75
5.6.210.0070.04517.62
5.6.200.0080.03316.28
5.6.190.0100.04017.50
5.6.180.0250.02917.67
5.6.170.0200.04017.47
5.6.160.0070.04317.59
5.6.150.0050.03916.23
5.6.140.0030.05016.39
5.6.130.0080.04216.32
5.6.120.0110.04117.66
5.6.110.0020.05217.82
5.6.100.0070.04017.82
5.6.90.0100.04317.57
5.6.80.0090.04217.50
5.6.70.0060.00914.29
5.6.60.0100.00314.35
5.6.50.0000.01414.74
5.6.40.0070.00414.39
5.6.30.0070.00314.52
5.6.20.0100.00314.25
5.6.10.0030.00914.47
5.6.00.0060.00614.23
5.5.380.0060.00314.54
5.5.370.0030.01214.48
5.5.360.0080.00614.42
5.5.350.0130.04317.47
5.5.340.0050.04516.24
5.5.330.0070.04617.39
5.5.320.1130.03317.26
5.5.310.0050.02717.20
5.5.300.0020.02616.21
5.5.290.0030.04716.18
5.5.280.0050.04717.68
5.5.270.0070.03317.61
5.5.260.0070.05017.71
5.5.250.0100.03117.52
5.5.240.0100.04217.23
5.5.230.0120.00614.26
5.5.220.0100.00614.23
5.5.210.0030.00714.37
5.5.200.0090.00614.47
5.5.190.0130.00314.46
5.5.180.0070.00714.30
5.5.170.0000.01514.04
5.5.160.0030.00614.38
5.5.150.0030.01014.33
5.5.140.0100.00314.61
5.5.130.0070.00714.52
5.5.120.0140.00014.15
5.5.110.0030.00914.36
5.5.100.0030.01014.30
5.5.90.0060.00914.48
5.5.80.0030.00714.55
5.5.70.0030.01014.19
5.5.60.0090.00614.16
5.5.50.0060.00814.55
5.5.40.0090.00614.23
5.5.30.0090.00614.11
5.5.20.0030.01014.36
5.5.10.0070.00714.02
5.5.00.0000.01014.28
5.4.450.0010.03815.78
5.4.440.0470.03715.82
5.4.430.0070.03115.98
5.4.420.0480.02615.88
5.4.410.0400.03715.84
5.4.400.0050.03415.75
5.4.390.0380.03315.69
5.4.380.0110.03215.61
5.4.370.0220.02715.52
5.4.360.0200.02815.46
5.4.350.0160.03115.54
5.4.340.0170.02615.40
5.4.330.0030.00712.38
5.4.320.0040.02312.45
5.4.310.0090.02112.45
5.4.300.0060.02112.45
5.4.290.0080.02012.45
5.4.280.0060.02112.40
5.4.270.0090.01812.40
5.4.260.0070.02212.40
5.4.250.0040.02512.40
5.4.240.0050.02112.39
5.4.230.0040.02412.39
5.4.220.0060.02212.39
5.4.210.0060.02412.39
5.4.200.0040.02412.39
5.4.190.0110.02512.38
5.4.180.0270.04312.39
5.4.170.0170.02512.39
5.4.160.0260.04912.39
5.4.150.0090.03112.39
5.4.140.0120.03012.23
5.4.130.0270.05712.22
5.4.120.0090.02912.20
5.4.110.0310.08312.20
5.4.100.0140.02412.20
5.4.90.0220.04112.20
5.4.80.0090.02712.20
5.4.70.0090.02912.20
5.4.60.0100.02412.20
5.4.50.0190.04812.20
5.4.40.0100.02712.19
5.4.30.0090.02812.19
5.4.20.0060.02812.19
5.4.10.0190.03112.19
5.4.00.0100.02311.93
5.3.290.0050.02512.59
5.3.280.0080.02212.54
5.3.270.0100.02912.55
5.3.260.0110.02612.55
5.3.250.0090.02612.55
5.3.240.0120.02612.55
5.3.230.0150.03512.54
5.3.220.0090.02512.53
5.3.210.0100.02712.53
5.3.200.0210.04812.53
5.3.190.0130.02512.53
5.3.180.0090.03012.53
5.3.170.0100.02612.52
5.3.160.0230.06012.53
5.3.150.0090.02612.53
5.3.140.0070.02812.52
5.3.130.0110.02612.52
5.3.120.0130.02412.52
5.3.110.0200.06312.52
5.3.100.0110.02512.25
5.3.90.0120.02212.24
5.3.80.0070.03012.23
5.3.70.0100.02612.23
5.3.60.0070.02712.22
5.3.50.0120.02512.20
5.3.40.0100.02912.20
5.3.30.0100.02812.19
5.3.20.0100.02712.07
5.3.10.0150.03412.05
5.3.00.0090.02712.04
5.2.170.0120.0359.19
5.2.160.0140.0339.18
5.2.150.0150.0319.18
5.2.140.0130.0339.18
5.2.130.0100.0389.14
5.2.120.0110.0359.14
5.2.110.0140.0369.15
5.2.100.0140.0339.14
5.2.90.0130.0339.14
5.2.80.0120.0369.14
5.2.70.0130.0349.13
5.2.60.0240.0859.09
5.2.50.0150.0339.06
5.2.40.0140.0339.04
5.2.30.0130.0339.02
5.2.20.0170.0309.00
5.2.10.0140.0318.93
5.2.00.0120.0328.78
5.1.60.0100.0298.07
5.1.50.0110.0298.06
5.1.40.0100.0318.05
5.1.30.0090.0338.40
5.1.20.0090.0338.43
5.1.10.0100.0328.14
5.1.00.0110.0308.14
5.0.50.0080.0256.63
5.0.40.0070.0246.48
5.0.30.0060.0376.30
5.0.20.0100.0216.27
5.0.10.0080.0236.25
5.0.00.0100.0346.24
4.4.90.0070.0174.78
4.4.80.0070.0174.76
4.4.70.0070.0184.75
4.4.60.0080.0174.75
4.4.50.0060.0184.77
4.4.40.0070.0284.70
4.4.30.0050.0204.76
4.4.20.0090.0174.85
4.4.10.0070.0204.85
4.4.00.0080.0284.76
4.3.110.0060.0194.67
4.3.100.0060.0184.66
4.3.90.0060.0194.63
4.3.80.0090.0274.58
4.3.70.0070.0204.63
4.3.60.0090.0174.63
4.3.50.0070.0184.63
4.3.40.0060.0314.54
4.3.30.0080.0163.28
4.3.20.0060.0193.28
4.3.10.0080.0153.23
4.3.00.0030.0276.61

preferences:
46.56 ms | 401 KiB | 5 Q