3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $key = "62851589ba33123ae2df"; $seed = "825d16b1c92240efae765d28cd2caa853d5578ffb045ed9e569e5827138aae39"; $nonce = 1; $hash = hash_hmac('sha512', $index$key . '-' . $nonce, $seed); $index = 0; $lucky = hexdec(substr($hash, $index * 5, 5)); while ($lucky >= pow(10, 6)) { $index++; $lucky = hexdec(substr($hash, $index * 5, 5)); if ($index * 5 + 5 > 128) { echo '99.99'; break; } } $lucky %= pow(10, 4); $lucky = sprintf('%.2f', bcdiv($lucky, '100', 2)); echo $lucky;
Output for 7.0.0 - 7.1.7
Parse error: syntax error, unexpected '$key' (T_VARIABLE), expecting ',' or ')' in /in/4dmnd on line 9
Process exited with code 255.
Output for hhvm-3.15.4
Fatal error: Uncaught Error: syntax error, unexpected T_VARIABLE, expecting ')' in /in/4dmnd:9 Stack trace: #0 {main}
Process exited with code 255.
Output for 5.6.0 - 5.6.30
Parse error: syntax error, unexpected '$key' (T_VARIABLE) in /in/4dmnd on line 9
Process exited with code 255.