3v4l.org

run code in 500+ PHP versions simultaneously
<?php // $countAfter[$i][$j] will contain the number of occurrences of a pair $i, $j in the randomly generated sequence $countAfter = [1 => [1 => 0, 2 => 0], 2 => [1 => 0, 2 => 0] ]; $prev = 1; // We assume for simplicify that the "previously" generated value was 1 for ($i = 0; $i < 10000; $i++) { $n = mt_rand(1, 2); $countAfter[$prev][$n]++; $prev = $n; } print_r($countAfter);

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.3.00.2720.01014.38
7.2.130.1730.00314.59
7.2.120.2400.01214.74
7.2.110.1640.00914.56
7.2.100.1750.00814.73
7.2.90.2330.01014.67
7.2.80.1590.01014.62
7.2.70.2630.01014.85
7.2.60.3740.01014.86
7.2.50.2250.01314.92
7.2.40.3290.00714.98
7.2.30.2500.01215.10
7.2.20.3060.00814.73
7.2.10.3290.00714.81
7.2.00.2450.00815.00
7.1.250.2340.00814.05
7.0.330.1730.01613.41
5.6.380.0090.01114.27

preferences:
49.34 ms | 553 KiB | 5 Q