Voting

: max(five, three)?
(Example: nine)

The Note You're Voting On

lauris at night dot lt
21 years ago
<?php
/**
* my_bcmod - get modulus (substitute for bcmod)
* string my_bcmod ( string left_operand, int modulus )
* left_operand can be really big, but be carefull with modulus :(
* by Andrius Baranauskas and Laurynas Butkus :) Vilnius, Lithuania
**/
function my_bcmod( $x, $y )
{
// how many numbers to take at once? carefull not to exceed (int)
$take = 5;
$mod = '';

do
{
$a = (int)$mod.substr( $x, 0, $take );
$x = substr( $x, $take );
$mod = $a % $y;
}
while (
strlen($x) );

return (int)
$mod;
}

// example
echo my_bcmod( "7044060001970316212900", 150 );
?>

<< Back to user notes page

To Top