3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $results = array(); for($i = 0; $i < 10000; $i++) { $results[] = (object) rand(0, 100000); } $start = microtime(true); for($i = 0; $i < 1000; $i++) { $alreadyOutput = array(); foreach ($results as $result) { if(in_array($result->date, $alreadyOutput)){ continue; } $alreadyOutput[] = $result->date; } } echo "in_array: ".(microtime(true) - $start)."ms || "; $start2 = microtime(true); for($i = 0; $i < 1000; $i++) { $echoedArray = array(); foreach ($results as $result) { if ($echoedArray[$result->date]) { continue; } $echoedArray[$result->date] = true; } } echo "by key: ".(microtime(true) - $start2)."ms";

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.1.70.0132.48521.28
7.1.60.0002.50121.42
7.1.50.0102.49121.39
7.1.00.0002.50026.79
7.0.200.1632.32920.16
7.0.140.0002.50026.40
7.0.60.0072.49324.89
7.0.50.0072.49322.66
7.0.40.0232.47720.03
7.0.30.0402.46020.03
7.0.20.0172.48320.12
7.0.10.0272.47320.05
7.0.00.0102.49020.15
5.6.280.0102.49026.94
5.6.210.0202.48026.55
5.6.200.0102.49023.98
5.6.190.0132.48726.14
5.6.180.0172.48326.20
5.6.170.0172.48326.29
5.6.160.0172.48326.16
5.6.150.0002.50023.91
5.6.140.0132.48724.03
5.6.130.0032.49723.96
5.6.120.0072.49327.01
5.6.110.0032.49726.75
5.6.100.0102.49026.83
5.6.90.0132.48726.84
5.6.80.0102.49026.27
5.6.70.3172.18326.28
5.5.350.0032.49726.25
5.5.340.0032.49723.82
5.5.330.0072.49326.12
5.5.320.0272.47325.94
5.5.310.0102.49025.75
5.5.300.0032.49723.73
5.5.290.0002.50023.78
5.5.280.0072.49326.50
5.5.270.0072.49326.53
5.5.260.0132.48726.78
5.5.250.0072.49326.51
5.5.240.0232.47726.09
5.4.450.0432.45324.89
5.4.440.4372.06025.14
5.4.430.0232.47324.89
5.4.420.0102.48725.36
5.4.410.0172.48024.87
5.4.400.0302.46724.87
5.4.390.3372.16024.87
5.4.380.0272.47024.56
5.4.370.4032.09324.70
5.4.360.0572.44024.57
5.4.350.0232.47324.82
5.4.340.0072.49024.82
5.4.320.0332.46324.86
5.4.310.0532.44324.85
5.4.300.0302.46724.68
5.4.290.0232.47325.02
5.4.280.0502.44724.60
5.4.270.0302.46724.91
5.4.260.0402.45724.71
5.4.250.0232.47325.03
5.4.240.0272.47024.83
5.4.230.0202.47724.86
5.4.220.0272.47025.01
5.4.210.0372.46024.80
5.4.200.0332.46324.86
5.4.190.0272.47024.84
5.4.180.0202.47724.87
5.4.170.7831.71325.01
5.4.160.0272.47325.00
5.4.150.3872.11024.79
5.4.140.4602.03722.09
5.4.130.0132.48322.04
5.4.120.0202.47722.06
5.4.110.0132.48322.16
5.4.100.0232.47322.16
5.4.90.0272.47022.00
5.4.80.0102.48721.97
5.4.70.0002.49722.05
5.4.60.0002.49722.20
5.4.50.0032.49722.24
5.4.40.0102.48722.30
5.4.30.0372.46022.13
5.4.20.0272.47022.12
5.4.10.3802.11722.18
5.4.00.3972.10021.54

preferences:
33.92 ms | 400 KiB | 5 Q