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.2.100.0110.00517.54
8.2.90.0250.00217.42
8.2.80.0200.00817.42
8.2.70.0230.00717.63
8.2.60.0270.00317.50
8.2.50.0210.00917.42
8.2.40.0270.00017.42
8.2.30.0130.01617.42
8.2.20.0030.01017.74
8.2.10.0130.01017.57
8.2.00.0170.00517.55
8.1.230.0060.00617.42
8.1.220.0230.00317.42
8.1.210.0160.01217.42
8.1.200.0270.00017.42
8.1.190.0240.00417.42
8.1.180.0220.00717.42
8.1.170.0220.00517.42
8.1.160.0280.00017.42
8.1.150.0230.00417.42
8.1.140.0170.00617.38
8.1.130.0160.00717.37
8.1.120.0190.00517.41
8.1.110.0130.00817.36
8.1.100.0170.00417.40
8.1.90.0180.00417.40
8.1.80.0170.00517.40
8.1.70.0130.00717.42
8.1.60.0170.00617.50
8.1.50.0180.00717.41
8.1.40.0160.00917.49
8.1.30.0230.00217.50
8.1.20.0150.00817.48
8.1.10.0100.01317.48
8.1.00.0190.00617.45
8.0.300.0090.00518.36
8.0.290.0230.00317.42
8.0.280.0100.01617.42
8.0.270.0150.00617.09
8.0.260.0130.00617.10
8.0.250.0140.00717.11
8.0.240.0160.00617.10
8.0.230.0190.00317.09
8.0.220.0180.00417.05
8.0.210.0120.00717.09
8.0.200.0150.00617.16
8.0.190.0150.00917.10
8.0.180.0210.00217.12
8.0.170.0120.00817.13
8.0.160.0110.00417.10
8.0.150.0130.00417.10
8.0.140.0120.00517.05
8.0.130.0160.00417.10
8.0.120.0190.00317.11
8.0.110.0130.00717.11
8.0.100.0150.00717.11
8.0.90.0120.00817.11
8.0.80.0170.00317.07
8.0.70.0130.00917.12
8.0.60.0200.00117.08
8.0.50.0090.00617.11
8.0.30.0120.00217.07
8.0.20.0140.00617.10
8.0.10.0100.00417.10

preferences:
31.07 ms | 400 KiB | 5 Q