3v4l.org

run code in 300+ PHP versions simultaneously
<?php $loopCount = 1e6; $min = 0; $max = mt_getrandmax()*2; $res = [ 'odd' => 0, 'even'=> 0, ]; while ($loopCount--) { $v = rand($min, $max); $v%2 ? $res['odd']++ : $res['even']++; } var_dump($res);

preferences:
30.39 ms | 406 KiB | 5 Q