3v4l.org

run code in 300+ PHP versions simultaneously
<?php $gens = []; for ($i = 0; $i < 1000; $i++) { $entropy=1; if (function_exists("posix_getpid")) $entropy *= posix_getpid(); if (function_exists("memory_get_usage")) $entropy *= memory_get_usage(); list($usec, $sec) = explode(" ", microtime()); $usec *= 1000000; $entropy *= $usec; mt_srand($entropy); $result = mt_rand(); if (in_array($result, $gens)) { echo 'Count: ' . count($gens); echo 'COLLISION: ' . $result; } else { $gens[] = $result; } }

preferences:
28.73 ms | 402 KiB | 5 Q