3v4l.org

run code in 300+ PHP versions simultaneously
<?php function comp_rand($min, $max) { $loops = 1000; while ($loops--) { $v = rand($min, $max); $v%2 ? @$rand['odd']++ : @$rand['even']++; $v = mt_rand($min, $max); $v%2 ? @$mt_rand['odd']++ : @$mt_rand['even']++; //$v = random_int($min, $max); //$v%2 ? @$random_int['odd']++ : @$random_int['even']++; } var_dump($rand, $mt_rand, $random_int); } // even only $min = 1; $max = mt_getrandmax()*2+1; comp_rand($min, $max); // odd only $min = 0; $max = mt_getrandmax()*2; comp_rand($min, $max);

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.0060.01315.08
7.3.120.0100.01014.84
7.3.110.0120.00614.81
7.3.100.0030.01014.93
7.3.90.0030.01014.97
7.3.80.0030.01014.86
7.3.70.0060.00914.81
7.3.60.0110.00415.00
7.3.50.0090.00614.71
7.3.40.0090.00614.86
7.3.30.0060.00614.67
7.3.20.0040.01116.64
7.3.10.0080.01016.29
7.3.00.0080.00916.16
7.2.250.0100.01015.27
7.2.240.0070.01014.96
7.2.230.0070.00715.23
7.2.220.0000.01715.36
7.2.210.0070.00415.16
7.2.200.0030.01415.20
7.2.190.0070.01015.25
7.2.180.0110.00615.11
7.2.170.0060.00914.80
7.2.130.0070.01016.50
7.2.120.0170.01017.09
7.2.110.0210.01116.42
7.2.100.0190.00616.13
7.2.90.0160.01416.48
7.2.80.0110.01416.16
7.2.70.0220.00516.66
7.2.60.0160.00916.68
7.2.50.0200.01116.70
7.2.40.0160.00316.83
7.2.30.0150.00416.78
7.2.20.0090.00616.44
7.2.10.0040.01616.18
7.2.00.0070.01118.18
7.1.330.0090.00615.80
7.1.320.0090.00615.65
7.1.310.0000.01415.82
7.1.300.0090.00615.84
7.1.290.0000.01815.91
7.1.280.0040.01215.88
7.1.270.0060.00615.55
7.1.260.0040.01115.75
7.1.250.0130.01014.92
7.1.70.0000.01117.03
7.1.60.0130.01319.19
7.1.50.0140.00716.63
7.1.00.0000.08022.40
7.0.200.0040.00416.92
7.0.60.0170.08319.99
7.0.50.0070.08017.89
7.0.40.0030.04720.37
7.0.30.0170.04320.12
7.0.20.0270.05320.22
7.0.10.0070.06320.16
7.0.00.0070.04020.12
5.6.280.0100.07021.00
5.6.210.0070.08320.63
5.6.200.0030.07318.16
5.6.190.0070.05020.57
5.6.180.0300.07720.61
5.6.170.0300.05020.47
5.6.160.0030.05020.71
5.6.150.0070.04718.22
5.6.140.0130.07718.14
5.6.130.0070.03718.33
5.6.120.0070.07021.12
5.6.110.0030.07020.96
5.6.100.0070.07720.99
5.6.90.0170.06320.98
5.6.80.0130.08020.39
5.5.350.3800.04720.33
5.5.340.0170.07017.97
5.5.330.0170.04020.19
5.5.320.0300.06320.25
5.5.310.0200.05320.34
5.5.300.0070.06717.95
5.5.290.0030.04717.92
5.5.280.0070.04320.90
5.5.270.0030.04720.87
5.5.260.0100.08320.88
5.5.250.0100.08320.77
5.5.240.0130.08320.24

preferences:
30.84 ms | 401 KiB | 5 Q