3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_mt_srand(?int $seed = null) { $GLOBALS['my_mt_rand'] = new \Random\Randomizer(new \Random\Engine\Mt19937($seed)); } function my_mt_rand($min = null, $max = null) { if (!isset($GLOBALS['my_mt_rand'])) { $GLOBALS['my_mt_rand'] = new \Random\Randomizer(new \Random\Engine\Mt19937()); } if ($min === null && $max === null) { return $GLOBALS['my_mt_rand']->nextInt(); } return $GLOBALS['my_mt_rand']->getInt($min, $max); } mt_srand(1234); my_mt_srand(1234); var_dump(mt_rand()); var_dump(my_mt_rand()); var_dump(mt_rand(1, 1000)); var_dump(my_mt_rand(1, 1000));

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.3.100.0200.00537.54
8.3.90.0250.01137.54
8.3.80.0200.01337.54
8.3.70.0260.00037.54
8.3.60.0170.00837.54
8.3.50.0220.00337.54
8.3.40.0170.00437.54
8.3.30.0230.00037.54
8.3.20.0210.00337.54
8.3.10.0160.00637.54
8.3.00.0220.00437.54
8.2.220.0170.00237.54
8.2.210.0180.00337.54
8.2.200.0180.00437.54
8.2.190.0170.00437.54
8.2.180.0220.00037.54
8.2.170.0270.00037.54
8.2.160.0180.00637.54
8.2.150.0200.00337.54
8.2.140.0190.00537.54
8.2.130.0210.00037.54
8.2.120.0070.01437.54
8.2.110.0150.00537.54
8.2.100.0130.00422.54
8.2.90.0190.00427.48
8.2.80.0200.00427.48
8.2.70.0180.00727.58
8.2.60.0270.00927.52
8.2.50.0300.00627.48
8.2.40.0280.00527.48
8.2.30.0240.01227.48
8.2.20.0170.00527.64
8.2.10.0130.00824.22
8.2.00.0180.00324.21
8.1.290.0240.00623.30
8.1.280.0280.00637.54
8.1.270.0210.00637.54
8.1.260.0160.00537.54
8.1.250.0410.00337.54
8.1.240.0250.00737.54
8.1.230.0110.00527.48
8.1.220.0230.00127.48
8.1.210.0210.00927.48
8.1.200.0240.00427.48
8.1.190.0240.00327.48
8.1.180.0260.00527.48
8.1.170.0210.00827.48
8.1.160.0220.00327.48
8.1.150.0190.00427.48
8.1.140.0150.00524.10
8.1.130.0170.00524.09
8.1.120.0210.00724.12
8.1.110.0170.01024.08
8.1.100.0190.00824.11
8.1.90.0250.00424.11
8.1.80.0220.00724.11
8.1.70.0210.00624.13
8.1.60.0220.00624.18
8.1.50.0220.00824.12
8.1.40.0200.00824.17
8.1.30.0250.00324.18
8.1.20.0190.01024.16
8.1.10.0180.01524.17
8.1.00.0250.00724.14
8.0.300.0180.00927.95
8.0.290.0240.00927.48
8.0.280.0200.01227.48
8.0.270.0210.00623.90
8.0.260.0200.00623.91
8.0.250.0210.00623.92
8.0.240.0210.00523.91
8.0.230.0210.00523.91
8.0.220.0190.00523.88
8.0.210.0140.00523.90
8.0.200.0140.00623.95
8.0.190.0130.00923.91
8.0.180.0180.00323.92
8.0.170.0150.00623.93
8.0.160.0130.00323.91
8.0.150.0130.00423.91
8.0.140.0130.00423.88
8.0.130.0170.00523.91
8.0.120.0210.00523.92
8.0.110.0180.00623.92
8.0.100.0180.00523.92
8.0.90.0150.00523.92
8.0.80.0170.00323.89
8.0.70.0130.00723.92
8.0.60.0190.00123.90
8.0.50.0100.00623.92
8.0.30.0130.00323.89
8.0.20.0130.00723.91
8.0.10.0120.00423.91

preferences:
30.61 ms | 403 KiB | 5 Q