scossdl_string_mod()
Compute string modulo, based on SHA1 hash
Хуков нет.
Возвращает
int. The remainder.
Использование
scossdl_string_mod( $str, $mod );
- $str(строка) (обязательный)
- The string.
- $mod(int) (обязательный)
- The divisor.
Код scossdl_string_mod() scossdl string mod WPSCache 3.0.3
function scossdl_string_mod( $str, $mod ) {
/**
* The full SHA1 is too large for PHP integer types.
* This should be enough for our purpose.
*/
$num = hexdec( substr( sha1( $str ), 0, 5 ) );
return $num % $mod;
}