@ 2013-02-08T00:46:02Z <?php
function hashCalc($arrKey)
{
$keyLen=count($arrKey);
$hash=5381;
$i=0;
for(;$keyLen>=8;$keyLen-=8)
{
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
$hash=(($hash<<5)+$hash)+$arrKey[$i++];
}
switch($keyLen)
{
case 7: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 6: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 5: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 4: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 3: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 2: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 1: $hash=(($hash<<5)+$hash)+$arrKey[$i++];
case 0:
default: break;
}
return $hash;
}
$arrInput=explode(",","0,1,2,3,4,5,6,7,8,9,1,2,3,4,5");
echo hashCalc($arrInput);
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Output for 8.1.0 - 8.1.28 , 8.2.0 - 8.2.18 , 8.3.0 - 8.3.6 Deprecated: Implicit conversion from float 1.3712707475956173E+19 to int loses precision in /in/26aTk on line 23
Deprecated: Implicit conversion from float 9.797488937524464E+18 to int loses precision in /in/26aTk on line 24
Deprecated: Implicit conversion from float 9.722485685244922E+18 to int loses precision in /in/26aTk on line 25
-6.4418707756273E+17 Output for 4.3.0 - 4.3.11 , 4.4.0 - 4.4.9 , 5.0.0 - 5.0.1 , 5.0.3 - 5.0.5 , 5.1.0 - 5.1.6 , 5.2.0 - 5.2.1 , 5.2.7 - 5.2.17 , 5.3.0 - 5.3.29 , 5.4.0 - 5.4.45 , 5.5.0 - 5.5.38 , 5.6.0 - 5.6.28 , 7.0.0 - 7.0.20 , 7.1.0 - 7.1.25 , 7.2.0 - 7.2.33 , 7.3.0 - 7.3.33 , 7.4.0 - 7.4.33 , 8.0.0 - 8.0.30 -6.4418707756273E+17 Output for 5.2.2 - 5.2.6 -644187077562730000 Output for 5.0.2 1.3712707475956E+19 preferences:dark mode live preview
251.52 ms | 401 KiB | 372 Q