Busco a la equelent PHP para la funciónPHP hashCode interna Función
"SomeString".hashCode();
de JAVA. El hashCode que estoy buscando debe ser el mismo que se utiliza para indexar Hashmaps en PHP. Espero que usted me puede ayudar :)
EDIT:
bien conocer la función que estaba buscando su escrito en C y no está disponible en sí mismo pero gracias por su ayuda PHP!
ulong zend_inline_hash_func(char *arKey, uint nKeyLength)
{
ulong $h = 5381;
char *arEnd = arKey + nKeyLength;
while (arKey < arEnd) {
$h += ($h << 5);
$h += (ulong) *arKey++;
}
return $h;
}
El método overflow32 es incorrecto (% v en lugar de $ v, y se divide por 0 en una máquina de 32 bits). En su lugar, la línea $ h = debería decir: '$ h = (int) (31 * $ h + ord ($ s [$ i])) & 0xffffffff;' – xryl669
@ xryl669, su línea regresará mal en 'hashCode ("153193cc3139f12e") '. devuelve 3369976574 en lugar de -924990722. – ahoo
Esto todavía no es aplicable para sistemas de 32 bits. – SOFe