$i < strlen($a); $i++) {
$b = ($b << 5) - $b + ord($a[$i]);
$b = $b & $b;
}
$b = $b & 0xFFFFFFFF;
if ($b & 0x80000000) {
$b = $b & ~0x80000000;
$b = -2147483648 + $b;
}
echo $b;
?>
<script>
function g(e, t) {
void 0 === t && (t = 0);
for (var n = t, r = e.length, o = 0; o < r; o += 1)
n = (n << 5) - n + e.charCodeAt(o),n &= n;
return n;
}
document.write(g('<?php echo $a;?>',42));
</script>
i get different output for js and php code after 13 or some characters in string, is this due to compiler ? how can i achieve same result in php as of js?
Well like. All of the PHP relating to $b is useless cause $b isn't used anywhere. It's just echo'd out in the end without altering the $a string
Обсуждают сегодня