3v4l.org

run code in 300+ PHP versions simultaneously
<?php define('MAX_INT', 100); // fill array by unique values // @param int $n array size // @return array with randow unique values function uniqRand($n) { $ret = []; for($i = 0; $i < $n; $i++) { $unq = false; while($unq != true) { $v = rand(0, MAX_INT); if(!count($ret) || !in_array($v, $ret)) { $ret[$i] = $v; $unq = true; } } } return $ret; } // uniqRand(n int) int[] // uniqRand(5) -> [1,5,100,2,4] $ret = uniqRand(5); var_dump($ret);

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.0.90.0040.00616.77
8.0.80.0050.00516.83
8.0.70.0030.00716.68
8.0.60.0120.00016.74
8.0.50.0070.00416.87
8.0.30.0070.00416.85
8.0.20.0070.00316.80
8.0.10.0070.00416.89
8.0.00.0060.00317.00
7.4.220.0080.00316.28
7.4.210.0090.00016.48
7.4.200.0090.00016.42
7.4.190.0060.00316.73
7.4.180.0030.00916.44
7.4.160.0000.01016.31
7.4.150.0110.00016.53
7.4.140.0040.00516.41
7.4.130.0080.00016.27
7.4.120.0030.00616.54
7.4.110.0030.00616.64
7.4.100.0000.00916.45
7.4.90.0030.00616.33
7.4.80.0050.00516.50
7.4.70.0000.00816.51
7.4.60.0000.00816.34
7.4.50.0030.00616.19
7.4.40.0030.00616.34
7.4.30.0050.00316.46
7.4.20.0050.00516.50
7.4.10.0030.00716.23
7.4.00.0030.00616.54
7.3.290.0040.00416.36
7.3.280.0000.00716.24
7.3.270.0080.00016.28
7.3.260.0030.00616.14
7.3.250.0090.00015.98
7.3.240.0030.00615.92
7.3.230.0040.00416.39
7.3.220.0040.00416.31
7.3.210.0070.00016.16
7.3.200.0080.00016.24
7.3.190.0040.00416.20
7.3.180.0000.00916.30
7.3.170.0030.00616.14
7.3.160.0070.00016.25
7.3.150.0000.00716.07
7.3.140.0040.00415.94
7.3.130.0000.01016.34
7.3.120.0040.00416.24
7.3.110.0000.00716.16
7.3.100.0070.00016.21
7.3.90.0000.00716.55
7.3.80.0000.00915.96
7.3.70.0060.00316.29
7.3.60.0050.00316.20
7.3.50.0030.00316.46
7.3.40.0070.00016.41
7.3.30.0030.00316.27
7.3.20.0040.00716.45
7.3.10.0050.00216.41
7.3.00.0000.00716.27

preferences:
38.19 ms | 401 KiB | 5 Q