3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Returns N±(0~n/m) randomness * * @param $n int Base number * @param $m int Fraction of number to use for random/ * * @return float */ function addRandomToN($n, $m) { $plus = mt_rand(0,1); if ($plus) { return $n + (($n/$m) * rand0To1()); } return $n - (($n/$m) * rand0To1()); } function rand0To1() { return (float)rand()/(float)getrandmax(); } echo addRandomToN(5, 0.1);

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.4.00.0070.01015.09
7.3.120.0090.00914.76
7.3.110.0030.00914.92
7.3.100.0040.00815.04
7.3.90.0120.00614.91
7.3.80.0060.01014.57
7.3.70.0110.00314.80
7.3.60.0070.00714.96
7.3.50.0060.00614.95
7.3.40.0060.00314.98
7.3.30.0070.00714.89
7.3.20.0030.01116.63
7.3.10.0150.00316.45
7.3.00.0060.01016.51
7.2.250.0040.01114.99
7.2.240.0070.01415.00
7.2.230.0070.01314.93
7.2.220.0000.01314.96
7.2.210.0060.01014.83
7.2.200.0070.00714.70
7.2.190.0040.01414.82
7.2.180.0000.01315.16
7.2.170.0060.00815.10
7.2.130.0110.00516.24
7.2.120.0140.00916.35
7.2.110.0100.01116.50
7.2.100.0210.00716.48
7.2.90.0110.00716.30
7.2.80.0270.00616.96
7.2.70.0230.01116.64
7.2.60.0190.00716.41
7.2.50.0180.00316.14
7.2.40.0140.01016.84
7.2.30.0120.00916.88
7.2.20.0800.00317.02
7.2.10.0220.00016.58
7.2.00.0180.00416.63
7.1.330.0070.00716.05
7.1.320.0030.01015.76
7.1.310.0030.01315.54
7.1.300.0080.00415.70
7.1.290.0000.00915.60
7.1.280.0130.00315.77
7.1.270.0000.01015.55
7.1.260.0090.00015.88
7.1.250.0190.00615.35
7.1.70.0090.00017.19
7.1.60.0140.01119.40
7.1.50.0060.00616.73
7.1.00.0030.07322.36
7.0.200.0160.00314.77
7.0.140.0030.07722.20
7.0.120.0070.07022.04
7.0.60.0070.04019.84
7.0.50.0130.04017.84
7.0.40.0030.05317.73
7.0.30.0100.07717.84
7.0.20.0070.08017.71
7.0.10.0070.08017.84
7.0.00.0100.08017.70
5.6.280.0070.07021.11
5.6.210.0170.07720.45
5.6.200.0030.08318.20
5.6.190.0100.07718.25
5.6.180.0130.03318.16
5.6.170.0130.08018.29
5.6.160.0030.08318.24
5.6.150.0070.08318.20
5.6.140.0100.07718.15
5.6.130.0070.08018.29
5.6.120.0030.08318.12
5.6.110.0000.05718.22
5.6.100.0030.06718.21
5.6.90.0070.08018.13
5.6.80.0100.07317.57
5.6.70.0030.07317.54
5.6.60.0030.04717.53
5.6.50.0000.04317.62
5.6.40.0070.08017.50
5.6.30.0100.05317.60
5.6.20.0030.08017.50
5.6.10.0100.07017.51
5.6.00.0100.07017.50
5.5.350.0100.07720.42
5.5.340.0170.06718.02
5.5.330.0130.03717.95
5.5.320.0030.04717.99
5.5.310.0070.05018.04
5.5.300.0100.07718.04
5.5.290.0070.05017.92
5.5.280.0030.07017.94
5.5.270.0030.08018.04
5.5.260.0200.07317.94
5.5.250.0070.08017.80
5.5.240.0100.04717.36
5.5.230.0070.05717.32
5.5.220.0070.07017.46
5.5.210.0170.06717.36
5.5.200.0070.08017.43
5.5.190.0030.06717.36
5.5.180.0130.07017.37
5.5.160.0130.06017.34
5.5.150.0100.05017.28
5.5.140.0100.06017.28
5.5.130.0030.06017.39
5.5.120.0070.05017.33
5.5.110.0070.06317.30
5.5.100.0030.07717.29
5.5.90.0100.07717.18
5.5.80.0100.07717.33
5.5.70.0130.07317.23
5.5.60.0100.05317.20
5.5.50.0100.06717.19
5.5.40.0000.05717.21
5.5.30.0030.07717.21
5.5.20.0130.06717.32
5.5.10.0200.05317.20
5.5.00.0070.05317.30
5.4.450.0070.08319.46
5.4.440.0070.08019.35
5.4.430.0030.08019.21
5.4.420.0030.08319.46
5.4.410.0130.07019.28
5.4.400.0130.06719.10
5.4.390.0070.06019.14
5.4.380.0070.03718.95
5.4.370.0070.06319.14
5.4.360.0100.03719.01
5.4.350.0030.06319.32
5.4.340.0100.07319.05
5.4.320.0070.04719.03
5.4.310.0000.08019.10
5.4.300.0030.04018.98
5.4.290.0100.03719.04
5.4.280.0070.07319.03
5.4.270.0000.06319.12
5.4.260.0000.07719.14
5.4.250.0130.07319.02
5.4.240.0030.08318.88
5.4.230.0030.07718.95
5.4.220.0100.04318.89
5.4.210.0130.06719.11
5.4.200.0170.06018.98
5.4.190.0100.06019.00
5.4.180.0100.07719.00
5.4.170.0130.06318.86
5.4.160.0000.08319.10
5.4.150.0030.06719.05
5.4.140.0200.06016.34
5.4.130.0030.05016.40
5.4.120.0000.05016.43
5.4.110.0100.07016.45
5.4.100.0030.07716.29
5.4.90.0100.07016.51
5.4.80.0100.05016.45
5.4.70.0100.06716.49
5.4.60.0030.08016.21
5.4.50.0030.04316.34
5.4.40.0070.04316.48
5.4.30.0170.03316.45
5.4.20.0070.07316.42
5.4.10.0070.06716.40
5.4.00.0000.04015.83
5.3.290.0100.06714.67
5.3.280.0100.07014.59
5.3.270.0070.04014.71
5.3.260.0070.07714.71
5.3.250.0030.07714.65
5.3.240.0070.07314.62
5.3.230.0100.07014.70
5.3.220.0030.08014.53
5.3.210.0030.08314.42
5.3.200.0070.05014.61
5.3.190.0070.08014.61
5.3.180.0070.08014.59
5.3.170.0030.04314.64
5.3.160.0000.06314.52
5.3.150.0100.03314.64
5.3.140.0100.06314.62
5.3.130.0130.07314.67
5.3.120.0000.08714.50
5.3.110.0070.07714.57
5.3.100.0030.05314.10
5.3.90.0030.03713.98
5.3.80.0000.04014.05
5.3.70.0030.03714.00
5.3.60.0030.04014.05
5.3.50.0000.03713.94
5.3.40.0000.04014.16
5.3.30.0070.03313.82
5.3.20.0030.03713.69
5.3.10.0000.04013.68
5.3.00.0000.03713.68
5.2.170.0000.03011.00
5.2.160.0000.03011.00
5.2.150.0000.03011.16
5.2.140.0000.04011.18
5.2.130.0030.02711.15
5.2.120.0030.02711.11
5.2.110.0030.02710.96
5.2.100.0030.02711.10
5.2.90.0030.02711.01
5.2.80.0000.03011.30
5.2.70.0000.03010.95
5.2.60.0000.03011.10
5.2.50.0000.03011.02
5.2.40.0030.02710.96
5.2.30.0030.02710.93
5.2.20.0000.03011.05
5.2.10.0170.02010.96
5.2.00.0030.03010.93
5.1.60.0000.0279.98
5.1.50.0000.0239.98
5.1.40.0000.0239.83
5.1.30.0030.02310.34
5.1.20.0070.02010.43
5.1.10.0070.02010.07
5.1.00.0000.02710.07
5.0.50.0000.0208.62
5.0.40.0000.0208.47
5.0.30.0030.0378.29
5.0.20.0030.0438.18
5.0.10.0030.0478.24
5.0.00.0100.0608.13
4.4.90.0030.0138.09
4.4.80.0100.0078.09
4.4.70.0000.0178.09
4.4.60.0000.0178.09
4.4.50.0000.0138.09
4.4.40.0070.0208.09
4.4.30.0000.0178.09
4.4.20.0000.0138.09
4.4.10.0000.0178.09
4.4.00.0000.0238.09
4.3.110.0030.0108.09
4.3.100.0030.0278.09
4.3.90.0100.0178.09
4.3.80.0000.0378.09
4.3.70.0030.0378.09
4.3.60.0030.0338.09
4.3.50.0030.0338.09
4.3.40.0030.0378.09
4.3.30.0070.0338.09
4.3.20.0030.0278.09
4.3.10.0000.0238.09
4.3.00.0000.0308.09

preferences:
25.27 ms | 401 KiB | 5 Q