3v4l.org

run code in 300+ PHP versions simultaneously
<?php $t = microtime(true); function passgen($l = 12) { $r = ""; $s = "1234567890qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM"; $slen = mb_strlen($s) - 1; for ($i = 0; $i < $l; $i++) { $r .= $s[mt_rand(0, $slen)]; } return $r; } for ($i = 0; $i < 100000; ++$i) passgen(); printf("%0.04f\n", microtime(true) - $t);

preferences:
37.05 ms | 402 KiB | 5 Q