3v4l.org

run code in 300+ PHP versions simultaneously
<?php error_reporting(0); $results = array(); for($i = 0; $i < 100000; $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 $result->date . "<br />"; } } 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; } echo $result->date . "<br />"; $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.2.00.0072.49463.33
7.1.70.0802.42161.40
7.1.60.0072.49561.39
7.1.50.0272.47461.34
7.1.00.0072.49366.69
7.0.200.6741.81661.96
7.0.140.0132.48770.30
7.0.60.0172.48366.89
7.0.50.0132.48764.78
7.0.40.0102.49023.63
7.0.30.0632.43723.69
7.0.20.0502.45023.62
7.0.10.0432.45723.61
7.0.00.0132.48723.45
5.6.280.0202.48077.73
5.6.210.0202.48376.18
5.6.200.0232.48073.55
5.6.190.0332.47075.93
5.6.180.0232.47775.75
5.6.170.0602.44375.80
5.6.160.0372.46775.79
5.6.150.0132.48773.64
5.6.140.0202.48373.55
5.6.130.0172.48373.63
5.6.120.0232.45776.46
5.6.110.0272.47776.53
5.6.100.0202.48376.43
5.6.90.0102.49076.45
5.6.80.0272.46075.88
5.6.70.4432.05775.85
5.5.350.0172.48377.53
5.5.340.0232.47773.45
5.5.330.0302.47375.55
5.5.320.0532.45075.63
5.5.310.0272.47375.60
5.5.300.0272.47773.43
5.5.290.0272.47773.33
5.5.280.0232.48076.33
5.5.270.0102.49076.36
5.5.260.0302.47076.23
5.5.250.0202.48376.16
5.5.240.0172.48775.74
5.4.450.0672.43074.76
5.4.440.3772.12074.66
5.4.430.1902.30775.64
5.4.420.0272.47074.96
5.4.410.0332.46374.66
5.4.400.0432.45774.44
5.4.390.4532.04774.62
5.4.380.0672.43374.66
5.4.370.0602.43774.33
5.4.360.0402.46074.34
5.4.350.0372.46074.64
5.4.340.0132.48375.25
5.4.320.0632.43774.45
5.4.310.0572.44374.33
5.4.300.0302.47074.30
5.4.290.0432.45374.41
5.4.280.0632.43774.30
5.4.270.0502.45074.60
5.4.260.0532.44774.48
5.4.250.0432.45774.25
5.4.240.0372.46074.29
5.4.230.0372.46374.28
5.4.220.0432.45374.61
5.4.210.0402.45774.43
5.4.200.0332.46374.46
5.4.190.0332.46374.45
5.4.180.0372.46374.21
5.4.170.3802.11774.45
5.4.160.0302.47074.41
5.4.150.3972.10074.27
5.4.140.4332.06371.58
5.4.130.0172.48071.61
5.4.120.0432.45371.62
5.4.110.2872.21071.52
5.4.100.0472.45373.62
5.4.90.0502.45071.77
5.4.80.0372.46372.54
5.4.70.0132.48373.25
5.4.60.0002.49772.19
5.4.50.0202.48071.96
5.4.40.0202.47771.98
5.4.30.0302.46771.81
5.4.20.0402.45771.61
5.4.10.4302.06771.80
5.4.00.3232.17371.23

preferences:
53.06 ms | 401 KiB | 5 Q