3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $serverSeed = "6a46a6c568e38835912c41cdf5c38812f25fb599b2160a8fbbfd772824e49e940f87bbe1f4d542a3748ab1b51cb6bd3619cf23a7a278695cae51479a4f12a9bf"; $clientSeed = "b9de60be57eb55ae5b9f2ad98226722cd91f039a"; $nonce = "0"; $seed = $serverSeed.'-'.$clientSeed.'-'.$nonce; do { $seed = sha1($seed); $lucky = hexdec(substr($seed,0,8)); } while ($lucky > 4294960000); $luckyNumber = ($lucky % 10000) / 100; if ($luckyNumber < 0) $luckyNumber = -$luckyNumber; echo $luckyNumber;
based on HIvkT
Output for 5.6.0 - 5.6.30, hhvm-3.18.5 - 3.22.0, 7.1.0 - 7.3.0beta1
18.28