PHP | bcmod() Function Last Updated : 20 Apr, 2018 Summarize Comments Improve Suggest changes Share Like Article Like Report The bcmod() function in PHP is an inbuilt function and is used to calculate modulus of an arbitrary precision numbers. This function accepts an arbitrary precision number and returns the modulus of that number after scaling the result to a specified precision. Syntax: string bcadd ( $dividend, $modulus) Parameters: This function accepts two parameters as shown in the above syntax and explained below: $dividend: This parameter is of string type and represents the dividend which will be divided by the given modulus value $modulus. This parameter is mandatory. $modulus: This parameter is of string type and represents the modulus. This parameter is mandatory. Return Value: This function returns the remainder when $dividend is divided by $modulus. In other words, it returns the value equivalent to ($dividend % $modulus). If $modulus is zero, then this function returns NULL. Examples: Input: $dividend = 11, $modulus = 3 Output: 2 Input: $dividend = 3, $modulus = 11 Output: 3 Below programs illustrate the bcmod() function in PHP : Program 1: php <?php // PHP program to illustrate bcmod() function // input numbers with arbitrary precision $dividend = "11"; $modulus = "3"; // calculates the modulus $res = bcmod($dividend, $modulus); echo $res; ?> Output: 2 Program 2: php <?php // PHP program to illustrate bcmod() function // input numbers with arbitrary precision $dividend = "3"; $modulus = "11"; // calculates the modulus $res = bcmod($dividend, $modulus); echo $res; ?> Output: 3 Reference: http://php.net/manual/en/function.bcmod.php Comment More infoAdvertise with us Next Article PHP | bcpow() Function B barykrg Follow Improve Article Tags : Web Technologies PHP PHP-bc Similar Reads PHP | bcpowmod() Function The bcpowmod() function in PHP is an inbuilt function and is used to raise an arbitrary precision base number to another exponent number reduced by a specified modulus. This function accepts three arbitrary precision numbers as strings and returns the base number raised to exponent modulo under a nu 2 min read PHP fmod() Function fmod stands for Floating Modulo. Modulo calculates the remainder of a division which is generally noted with the '%' symbol. However, the general modulo expression expects both the divisor and dividend to be of integer type, this is a great limitation to such an important operation. In PHP the fmod( 2 min read PHP | bcadd() Function The bcadd() function in PHP is an inbuilt function and is used to add two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the addition of the two numbers after scaling the result to a specified precision. Syntax: string bcadd ( $num_str1, $nu 2 min read PHP | bcdiv() Function The bcdiv() function in PHP is an inbuilt function and is used to divide two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the division of the two numbers after scaling the result to a specified precision. Syntax: string bcdiv ( $num_str1, 2 min read PHP | bcpow() Function The bcpow() function in PHP is an inbuilt function and is used to calculate the value of an arbitrary precision base number raised to another exponent number. This function accepts two arbitrary precision numbers as strings and returns the base number raised to exponent after scaling the result to a 2 min read PHP | bcmul() Function The bcmul() function in PHP is an inbuilt function and is used to multiply two arbitrary precision numbers. This function accepts two arbitrary precision numbers as strings and returns the multiplication of the two numbers after scaling the result to a specified precision. Syntax: string bcmul ( $nu 2 min read Like