3v4l.org

run code in 300+ PHP versions simultaneously
<?php final class ArrayUtils { public static function containsSum(array $data, int $sum): bool { $max = count($data); for ($i = 0; $i < $max; $i += 1) { $v1 = $data[$i]; for ($j = $i + 1; $j < $max; $j += 1) { $v2 = $data[$j]; if ($v1 + $v2 === $sum) { return true; } } } return false; } } $data = range(0, 4999); shuffle($data); var_dump(ArrayUtils::containsSum($data, 1220)); var_dump(ArrayUtils::containsSum($data, -7));

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)
7.4.00.0070.33615.13
7.3.120.0070.51115.01
7.3.110.0100.52014.79
7.3.100.0070.39214.93
7.3.90.0070.46515.19
7.3.80.0070.48214.94
7.3.70.0030.48715.00
7.3.60.0030.45214.99
7.3.50.0030.46315.13
7.3.40.0000.37014.96
7.3.30.0030.46415.06
7.3.20.0070.35716.56
7.3.10.0030.52916.68
7.3.00.0030.36116.65
7.2.250.0070.44015.27
7.2.240.0070.63115.19
7.2.230.0030.50215.24
7.2.220.0070.50515.13
7.2.210.0100.59315.11
7.2.200.0070.47715.35
7.2.190.0070.65015.34
7.2.180.0100.45915.08
7.2.170.0030.66115.15
7.2.110.0190.44615.04
7.2.100.0160.40315.16
7.2.90.0130.44115.14
7.2.80.0230.44415.04
7.2.70.0230.61015.09
7.2.60.0230.40515.06
7.2.50.0160.40415.12
7.2.40.0200.49115.40
7.2.30.0200.41215.16
7.2.20.0200.37615.04
7.2.10.0200.40914.93
7.2.00.0200.40215.07
7.1.330.0030.99915.88
7.1.320.0001.07415.80
7.1.310.0000.90915.66
7.1.300.0031.14015.91
7.1.290.0030.96815.86
7.1.280.0031.03615.84
7.1.270.0000.98516.00
7.1.260.0070.93615.61
7.1.230.0160.55413.99
7.1.220.0160.45214.23
7.1.210.0170.38214.16
7.1.200.0120.50714.21
7.1.190.0100.40214.02
7.1.180.0160.41314.19
7.1.170.0220.41714.14
7.1.160.0170.49214.23
7.1.150.1120.40614.03
7.1.140.0070.39114.05
7.1.130.0200.41613.86
7.1.120.0200.38814.26
7.1.110.0220.37613.95
7.1.100.0130.39414.11
7.1.90.0260.37814.09
7.1.80.0190.40213.91
7.1.70.0160.38514.27
7.1.60.0370.41031.90
7.1.50.0400.50032.03
7.1.40.0430.42532.16
7.1.30.0330.41032.11
7.1.20.0330.38231.93
7.1.10.0260.38413.85
7.1.00.0200.38414.01
5.6.380.0120.00314.21

preferences:
31.61 ms | 400 KiB | 5 Q