The gmp_mod() is an inbuilt function in PHP which is used to find the mudulo of a GMP number(GNU Multiple Precision: For large numbers) with another GMP number $d where the sign of $d is neglected.
gmp_mod ( $num, $d )
Parameters: The function accepts two GMP numbers $num and $d as mandatory parameters as shown in the above syntax. These parameters can be a GMP object in PHP version 5.6 and later, or we are also allowed to pass multiple numeric strings provided that it is possible to convert that string to a number.
Return Value: The function returns a GMP number which is equivalent to ($num % $d).
Input : $num="8" $d="3" Output : 2 Input : $num="10" $d="4" Output : 2
Below programs illustrate the gmp_mod() function:
Program 1: The program below demonstrates the working of gmp_mod() function when numeric string are passed as arguments.
Program 2: The program below demonstrates the working of gmp_mod() when GMP number are passed as arguments.
- How to get the function name inside a function in PHP ?
- PHP | tan( ) Function
- PHP | Ds\Set contains() Function
- PHP | end() Function
- PHP | pos() Function
- PHP | key() Function
- PHP | Ds\Map put() Function
- p5.js | value() Function
- p5.js | max() function
- PHP | Ds\Map xor() Function
- D3.js | d3.rgb() Function
- p5.js | pow() function
- p5.js | day() function
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.