How to use bcpowmod() to raise an arbitrary precision number to another and get modulus of the result in PHP

1 Answer

0 votes
// string bcpowmod(string $left_operand , string $right_operand , 
//                 string $modulus [, int $scale = 0 ])

echo bcpowmod(2, 3, 3) . "<br />"; // 8 % 3

echo bcmod(bcpow(2, 3), 3) . "<br />"; // 8 % 3

/*
run: 

2
2 

*/

 



answered Jun 1, 2016 by avibootz
...