3v4l.org

run code in 300+ PHP versions simultaneously
<?php function build_external_url(string $host, string $path = null, array $query = [], string $schema = null, int $port = null): string { $url = $host; if (null !== $port) { $url .= ':' . $port; } if (null !== $path) { $url .= '/' . ltrim($path, '/'); } if (! empty($query)) { $url .= '?' . http_build_query($query); } return (null === $schema ? $url : ($schema . '://' . $url)); } $tests = [ [ 'foo.co' ], [ 'foo.co', '/bar' ], [ 'foo.co', 'bar', [ 'x' => 'baz' ]], [ 'foo.co', 'bar', [], 'ftp' ], [ 'foo.co', 'bar', ['email' => 'me@foo.co'], 'ftp', '24225'], ]; foreach ($tests as $args) { echo build_external_url(...$args) . 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.120.0090.01024.44
8.4.110.0130.01118.77
8.4.100.0040.00718.65
8.4.90.0130.00822.18
8.4.80.0060.00517.98
8.4.70.0130.00718.15
8.4.60.0110.01018.76
8.4.50.0100.00920.59
8.4.40.0150.00419.70
8.4.30.0060.01317.91
8.4.20.0100.01020.60
8.4.10.0100.01019.52
8.3.250.0110.00818.78
8.3.240.0140.00417.07
8.3.230.0080.01016.76
8.3.220.0130.00519.06
8.3.210.0100.00916.70
8.3.200.0060.00216.52
8.3.190.0120.00718.94
8.3.180.0060.00218.62
8.3.170.0070.01116.98
8.3.160.0040.00420.19
8.3.150.0090.00616.81
8.3.140.0060.00316.62
8.3.130.0100.00718.55
8.3.120.0050.00318.94
8.3.110.0090.00620.94
8.3.100.0040.00416.63
8.3.90.0040.01126.77
8.3.80.0100.00016.75
8.3.70.0130.00716.75
8.3.60.0120.00318.36
8.3.50.0090.00617.60
8.3.40.0040.01118.59
8.3.30.0160.00018.83
8.3.20.0040.00421.86
8.3.10.0030.00618.50
8.3.00.0000.00819.38
8.2.290.0090.00120.49
8.2.280.0050.00618.34
8.2.270.0090.00917.07
8.2.260.0070.00717.16
8.2.250.0060.00316.78
8.2.240.0060.00317.32
8.2.230.0050.00322.58
8.2.220.0030.00637.54
8.2.210.0130.00726.77
8.2.200.0040.00416.50
8.2.190.0140.00716.58
8.2.180.0110.00418.29
8.2.170.0070.00722.96
8.2.160.0070.00719.29
8.2.150.0000.00824.18
8.2.140.0060.00324.66
8.2.130.0000.00726.16
8.2.120.0000.00719.83
8.2.110.0080.00322.08
8.2.100.0080.00417.84
8.2.90.0000.00819.36
8.2.80.0040.00417.97
8.2.70.0040.00417.63
8.2.60.0030.00618.16
8.2.50.0030.00617.98
8.2.40.0080.00419.61
8.2.30.0060.00518.64
8.2.20.0010.00618.12
8.2.10.0060.00718.82
8.2.00.0060.00518.08
8.1.330.0100.00922.02
8.1.320.0110.00816.14
8.1.310.0070.01018.35
8.1.300.0150.00416.04
8.1.290.0050.00530.84
8.1.280.0000.01425.92
8.1.270.0000.00921.99
8.1.260.0060.00326.35
8.1.250.0070.00028.09
8.1.240.0090.00023.89
8.1.230.0040.00722.20
8.1.220.0040.00417.74
8.1.210.0040.00418.77
8.1.200.0030.00717.47
8.1.190.0060.00317.10
8.1.180.0120.00418.10
8.1.170.0090.00519.28
8.1.160.0080.00418.43
8.1.150.0040.00818.48
8.1.140.0020.00619.22
8.1.130.0060.00617.73
8.1.120.0090.00417.76
8.1.110.0080.00517.76
8.1.100.0090.00317.79
8.1.90.0060.00817.77
8.1.80.0080.00417.81
8.1.70.0030.00817.75
8.1.60.0050.00917.85
8.1.50.0090.00417.77
8.1.40.0060.00717.78
8.1.30.0060.00717.81
8.1.20.0070.00517.84
8.1.10.0080.00417.81
8.1.00.0110.00217.79
8.0.300.0020.00518.77
8.0.290.0040.00416.75
8.0.280.0050.00818.28
8.0.270.0070.00517.70
8.0.260.0040.00817.46
8.0.250.0060.00517.53
8.0.240.0090.00317.52
8.0.230.0060.00617.47
8.0.220.0060.00617.48
8.0.210.0100.00217.49
8.0.200.0070.00517.52
8.0.190.0080.00417.47
8.0.180.0060.00617.52
8.0.170.0070.00617.52
8.0.160.0080.00417.50
8.0.150.0060.00717.52
8.0.140.0080.00517.49
8.0.130.0080.00315.72
8.0.120.0090.00417.50
8.0.110.0060.00517.46
8.0.100.0100.00217.41
8.0.90.0100.00317.50
8.0.80.0060.01017.14
8.0.70.0120.00517.49
8.0.60.0170.00217.42
8.0.50.0130.00417.43
8.0.30.0170.00817.13
8.0.20.0110.00617.32
8.0.10.0070.01317.34
8.0.00.0110.00817.13
7.4.330.0080.00216.82
7.4.320.0060.00817.29
7.4.300.0070.00517.36
7.4.290.0050.00717.23
7.4.280.0060.00617.35
7.4.270.0050.00416.97
7.4.260.0080.00417.29
7.4.250.0040.00717.36
7.4.240.0090.00317.29
7.4.230.0060.00517.40
7.4.220.0050.00717.38
7.4.210.0060.00916.85
7.4.200.0080.00717.35
7.4.190.0080.00617.33
7.4.180.0110.00517.30
7.4.160.0110.00716.76
7.4.150.0120.00517.01
7.4.140.0090.00917.02
7.4.130.0070.01116.91
7.4.120.0100.01116.77
7.4.110.0130.00816.74
7.4.100.0100.00717.14
7.4.90.0100.00816.79
7.4.80.0100.01117.24
7.4.70.0100.01016.70
7.4.60.0090.01016.73
7.4.50.0100.00716.74
7.4.40.0130.00716.75
7.4.30.0140.00816.80
7.4.20.0180.00416.84
7.4.10.0130.01016.80
7.4.00.0110.00716.45
7.3.330.0080.00215.75
7.3.320.0050.00515.72
7.3.310.0030.00717.26
7.3.300.0070.00417.26
7.3.290.0060.01216.94
7.3.280.0060.00916.77
7.3.270.0150.00916.91
7.3.260.0110.00716.70
7.3.250.0100.01216.93
7.3.240.0110.00916.60
7.3.230.0130.00616.73
7.3.220.0090.01316.74
7.3.210.0130.00716.70
7.3.200.0130.00516.77
7.3.190.0100.01016.69
7.3.180.0100.00916.73
7.3.170.0120.00716.59
7.3.160.0140.00716.68
7.3.150.0150.00616.65
7.3.140.0130.01016.79
7.3.130.0140.00916.71
7.3.120.0140.01016.68
7.3.110.0130.01116.71
7.3.100.0120.00816.35
7.3.90.0120.00816.81
7.3.80.0080.01216.75
7.3.70.0090.00916.72
7.3.60.0100.00916.75
7.3.50.0100.00916.80
7.3.40.0110.00816.70
7.3.30.0100.01116.73
7.3.20.0330.01116.20
7.3.10.0170.00916.49
7.3.00.0200.00716.43
7.2.340.0140.00816.79
7.2.330.0140.00916.65
7.2.320.0110.01216.75
7.2.310.0130.01016.71
7.2.300.0150.00816.81
7.2.290.0120.01016.76
7.2.280.0150.01116.75
7.2.270.0180.00916.74
7.2.260.0150.00816.77
7.2.250.0170.01016.76
7.2.240.0160.00816.83
7.2.230.0140.01116.80
7.2.220.0160.00716.83
7.2.210.0160.01116.82
7.2.200.0140.01316.93
7.2.190.0120.01316.86
7.2.180.0170.01016.78
7.2.170.0130.01016.87
7.2.160.0170.00916.86
7.2.150.0210.01016.57
7.2.140.0260.00716.53
7.2.130.0250.00716.63
7.2.120.0200.01316.67
7.2.110.0210.01316.62
7.2.100.0280.00716.68
7.2.90.0220.00916.50
7.2.80.0200.00816.51
7.2.70.0240.01116.63
7.2.60.0250.00816.52
7.2.50.0220.01016.65
7.2.40.0230.01016.60
7.2.30.0220.00916.56
7.2.20.0230.00916.60
7.2.10.0300.00916.61
7.2.00.0220.00816.60
7.1.330.0200.00816.13
7.1.320.0180.01016.16
7.1.310.0160.01016.13
7.1.300.0210.00416.13
7.1.290.0260.01016.10
7.1.280.0160.01016.08
7.1.270.0210.00816.12
7.1.260.0150.00816.09
7.1.250.0210.01015.72
7.1.240.0140.01016.03
7.1.230.0180.00816.06
7.1.220.0190.00916.11
7.1.210.0140.00916.04
7.1.200.0170.01016.11
7.1.190.0180.01016.08
7.1.180.0180.00716.06
7.1.170.0170.01016.08
7.1.160.0200.00616.04
7.1.150.0180.00816.04
7.1.140.0480.00616.08
7.1.130.0190.00816.09
7.1.120.0190.00516.09
7.1.110.0160.01116.10
7.1.100.0190.00616.08
7.1.90.0160.00816.03
7.1.80.0220.01016.09
7.1.70.0180.00716.05
7.1.60.0250.00816.09
7.1.50.0160.00916.13
7.1.40.0170.00816.14
7.1.30.0230.01316.11
7.1.20.0210.00616.04
7.1.10.0170.00616.11
7.1.00.0170.00716.11

preferences:
26.95 ms | 403 KiB | 5 Q