3v4l.org

run code in 300+ PHP versions simultaneously
<?php function fillRandom($range, $num = 1, $value = TRUE, $data = array(), $anon = NULL) { if (empty($data)) $data = array_fill($range[0], $range[1]+1, FALSE); if ($anon === NULL) { $anon = function($el) use($value) { return $el !== $value; }; } for ($i=0; $i<$num; $i++) { do { $key = mt_rand($range[0], $range[1]); } while (isSet($data[$key]) && !$anon($data[$key])); $data[$key] = $value; } return $data;}$input = fillRandom(array(0, 5), 4);ksort($input);print_r($input);$input = fillRandom(array(0, 5), 2, 2, $input, function($el){ return $el === TRUE;});ksort($input);print_r($input);

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.0040.00416.93
7.1.60.0180.00719.40
7.1.50.0090.01517.02
7.1.00.0000.08022.36
7.0.200.0000.00716.81
7.0.140.0070.06722.12
7.0.110.0070.05020.08
7.0.100.0030.08320.02
7.0.90.0230.03319.91
7.0.80.0100.06020.07
7.0.70.0000.04319.95
7.0.60.0030.05320.11
7.0.50.0030.03719.91
7.0.40.0030.05719.71
7.0.30.0070.05019.85
7.0.20.0000.09019.70
7.0.10.0030.06319.68
7.0.00.0100.05019.68
5.6.280.0070.07321.14
5.6.260.0100.07720.61
5.6.250.0070.04720.67
5.6.240.0070.04020.64
5.6.230.0070.06320.59
5.6.220.0030.04720.63
5.6.210.0070.03720.59
5.6.200.0000.08720.62
5.6.190.0030.07720.57
5.6.180.0070.05020.87
5.6.170.0130.04320.58
5.6.160.0070.04720.57
5.6.150.0000.05320.57
5.6.140.0070.04020.65
5.6.130.0130.07320.69
5.6.120.0100.05720.71
5.6.110.0100.07720.71
5.6.100.0170.07320.63
5.6.90.0130.07720.54
5.6.80.0070.06320.03
5.6.70.0100.03720.04
5.6.60.0070.04320.02
5.6.50.0070.07719.91
5.6.40.0070.08320.07
5.6.30.0170.06320.22
5.6.20.0070.08320.21
5.6.10.0170.06320.22
5.6.00.0100.07319.95
5.5.380.0030.04317.69
5.5.370.0070.05317.52
5.5.360.0030.05317.52
5.5.350.0030.04017.52
5.5.340.0030.07717.93
5.5.330.0030.07717.96
5.5.320.0030.08317.91
5.5.310.0070.03718.25
5.5.300.0030.04017.93
5.5.290.0070.08317.95
5.5.280.0070.08317.91
5.5.270.0030.08017.91
5.5.260.0200.06318.09
5.5.250.0130.06317.88
5.5.240.0100.06717.34
5.5.230.0130.07017.30
5.5.220.0100.07017.63
5.5.210.0100.06717.48
5.5.200.0070.07717.26
5.5.190.0030.04717.45
5.5.180.0070.07717.19
5.5.160.0030.04717.48
5.5.150.0030.06717.28
5.5.140.0100.03317.45
5.5.130.0070.06317.48
5.5.120.0000.08317.28
5.5.110.0070.06717.43
5.5.100.0000.04717.33
5.5.90.0030.05317.35
5.5.80.0100.04317.16
5.5.70.0070.08017.31
5.5.60.0070.04017.14
5.5.50.0100.06317.31
5.5.40.0170.06317.34
5.5.30.0030.04317.14
5.5.20.0070.07717.49
5.5.10.0100.06017.31
5.5.00.0030.05017.33
5.4.450.0000.05319.33
5.4.440.0030.05719.34
5.4.430.0030.07719.64
5.4.420.0030.07719.27
5.4.410.0100.04019.22
5.4.400.0100.06719.20
5.4.390.0000.08319.34
5.4.380.0100.06319.31
5.4.370.0030.04318.99
5.4.360.0070.06019.34
5.4.350.0070.05019.18
5.4.340.0100.06019.20
5.4.320.0030.07019.03
5.4.310.0100.03719.23
5.4.300.0100.07718.95
5.4.290.0170.07019.00
5.4.280.0130.04318.98
5.4.270.0130.05719.18
5.4.260.0130.06319.09
5.4.250.0030.05319.32
5.4.240.0030.06019.23
5.4.230.0030.04319.30
5.4.220.0100.07018.98
5.4.210.0030.04319.24
5.4.200.0100.03319.18
5.4.190.0100.03719.00
5.4.180.0030.04718.97
5.4.170.0000.07718.99
5.4.160.0070.07319.01
5.4.150.0100.07318.95
5.4.140.0070.04316.46
5.4.130.0030.06316.50
5.4.120.0130.02716.68
5.4.110.0070.05316.46
5.4.100.0070.06016.63
5.4.90.0100.06316.55
5.4.80.0070.03716.59
5.4.70.0070.04016.59
5.4.60.0070.03316.48
5.4.50.0100.03016.52
5.4.40.0100.02716.36
5.4.30.0030.03716.39
5.4.20.0070.05016.56
5.4.10.0070.03316.49
5.4.00.0030.03315.73
5.3.290.0070.06314.71
5.3.280.0030.07714.57
5.3.270.0000.04014.58
5.3.260.0030.07314.61
5.3.250.0100.04014.74
5.3.240.0000.08014.59
5.3.230.0100.04014.62
5.3.220.0170.05014.71
5.3.210.0070.07714.70
5.3.200.0100.03714.59
5.3.190.0130.05314.70
5.3.180.0000.05314.71
5.3.170.0070.03314.53
5.3.160.0030.05314.43
5.3.150.0070.03014.43
5.3.140.0030.03714.56
5.3.130.0030.03314.61
5.3.120.0030.03714.57
5.3.110.0100.03014.55
5.3.100.0070.03014.05
5.3.90.0100.03014.02
5.3.80.0000.04014.00
5.3.70.0070.03314.04
5.3.60.0000.04014.23
5.3.50.0030.03313.94
5.3.40.0030.03714.11
5.3.30.0000.03313.99
5.3.20.0030.03013.93
5.3.10.0100.02313.63
5.3.00.0030.03313.61
5.2.170.0030.03011.92
5.2.160.0070.02711.92
5.2.150.0030.03011.92
5.2.140.0000.03011.92
5.2.130.0030.02311.92
5.2.120.0030.02311.92
5.2.110.0030.04311.92
5.2.100.0100.05711.92
5.2.90.0030.03311.92
5.2.80.0000.03011.92
5.2.70.0000.03311.92
5.2.60.0000.03711.92
5.2.50.0030.03011.92
5.2.40.0070.04311.92
5.2.30.0000.03311.92
5.2.20.0070.02311.92
5.2.10.0000.03011.92
5.2.00.0000.03011.92
5.1.60.0030.02311.92
5.1.50.0030.02711.92
5.1.40.0070.02011.92
5.1.30.0030.02311.92
5.1.20.0000.02311.92
5.1.10.0000.02711.92
5.1.00.0000.02711.92
5.0.50.0030.01711.92
5.0.40.0000.02011.92
5.0.30.0030.03011.92
5.0.20.0000.02011.92
5.0.10.0030.01711.92
5.0.00.0000.03311.92
4.4.90.0070.01011.92
4.4.80.0000.01711.92
4.4.70.0030.01711.92
4.4.60.0000.01711.92
4.4.50.0070.01011.92
4.4.40.0000.04311.92
4.4.30.0000.01711.92
4.4.20.0070.01311.92
4.4.10.0000.01711.92
4.4.00.0000.02711.92
4.3.110.0000.01711.92
4.3.100.0000.01711.92
4.3.90.0030.01711.92
4.3.80.0030.02311.92
4.3.70.0030.01311.92
4.3.60.0000.02011.92
4.3.50.0030.01311.92
4.3.40.0000.04011.92
4.3.30.0000.02011.92
4.3.20.0000.01711.92
4.3.10.0000.01711.92
4.3.00.0000.01311.92

preferences:
37.52 ms | 401 KiB | 5 Q