3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function string_inthash($str) { $a = (int)preg_replace('#[^0-9]#u', '', sha1($str)) * (int)date('YmdHis'); return (int)$a; } $str = 'secret'; echo string_inthash($str); /* $a = date('YmdHi'); $b = 'secret'; $bb = sha1($b); $bc = preg_replace('#[^0-9]#u', '', $bb); $bd = (int)$bc - (int)$a; $c = "{$b}|{$a}"; $d = base64_encode($c); $e = base64_decode($d); echo $a . PHP_EOL; echo $b . PHP_EOL; echo $bb . PHP_EOL; echo $bc . PHP_EOL; echo $bd . PHP_EOL; echo $c . PHP_EOL; echo $d . PHP_EOL; echo $e . PHP_EOL; */
Output for 5.5.0 - 5.6.28, 7.0.0 - 7.1.0
-9223372036854775808
Output for 4.3.0 - 5.0.1, 5.0.3 - 5.4.45, hhvm-3.10.0 - 3.12.0
0
Output for 5.0.2
9223372036854775807