scossdl_string_mod()
Compute string modulo, based on SHA1 hash
No Hooks.
Return
Int
. The remainder.
Usage
scossdl_string_mod( $str, $mod );
- $str(string) (required)
- The string.
- $mod(int) (required)
- The divisor.
scossdl_string_mod() scossdl string mod code WPSCache 1.12.4
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; }