3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?phpfunction generateHash($delka_retezce,$capt=false) { if ($capt==true) $mozne_znaky='123456789ABCDEFGHIJKLMNPQRSTUVWXYZ'; else $mozne_znaky='abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $vystup=''; for ($i=0;$i<$delka_retezce;$i++) $vystup.=$mozne_znaky[mt_rand(0,strlen($mozne_znaky)-1)]; return $vystup;}function generateServerSeed() { $rand_nr=mt_rand(0.01*100,99.99*100)/100; if (mt_rand(0,1)==1) $pre_rand=($rand_nr-0.01); else $pre_rand=($rand_nr+0.01); $str=generateHash(26).'-'.((double)(($pre_rand+0.001).mt_rand(0,99999999999999999999999999999))); return $str;}function newPlayer() { for ($b=0;$b<10000;$b++){ $serverseed=generateServerSeed(); $seedhash=substr($serverseed,0,27); $zzserverseed=(double)substr($serverseed,27); $z=$seedhash.sprintf("%.32f",$zzserverseed); //echo $z."<br>"; //echo hash('sha256', $z)."<br>"; } }$m=microtime();$a=$_GET["seed"];mt_srand($a);newPlayer();$n=microtime();echo $m."<br>";echo $n;?>
based on 9fufH
Output for 5.4.34 - 5.6.7
Parse error: syntax error, unexpected 'generateHash' (T_STRING) in /in/NSo1i on line 1
Process exited with code 255.
Output for 5.4.0 - 5.4.32
<?phpfunction generateHash($delka_retezce,$capt=false) { if ($capt==true) $mozne_znaky='123456789ABCDEFGHIJKLMNPQRSTUVWXYZ'; else $mozne_znaky='abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ'; $vystup=''; for ($i=0;$i<$delka_retezce;$i++) $vystup.=$mozne_znaky[mt_rand(0,strlen($mozne_znaky)-1)]; return $vystup;}function generateServerSeed() { $rand_nr=mt_rand(0.01*100,99.99*100)/100; if (mt_rand(0,1)==1) $pre_rand=($rand_nr-0.01); else $pre_rand=($rand_nr+0.01); $str=generateHash(26).'-'.((double)(($pre_rand+0.001).mt_rand(0,99999999999999999999999999999))); return $str;}function newPlayer() { for ($b=0;$b<10000;$b++){ $serverseed=generateServerSeed(); $seedhash=substr($serverseed,0,27); $zzserverseed=(double)substr($serverseed,27); $z=$seedhash.sprintf("%.32f",$zzserverseed); //echo $z."<br>"; //echo hash('sha256', $z)."<br>"; } }$m=microtime();$a=$_GET["seed"];mt_srand($a);newPlayer();$n=microtime();echo $m."<br>";echo $n;?>