The gmp_div_r() function is an in-built function in PHP which performs the division operation between two GMP numbers (GNU Multiple Precision : For large numbers) and returns the remainder.
Parameters : This function accepts two GMP numbers, $num1 and $num2 as mandatory parameters as shown in the above syntax. These parameters can be GMP objects in PHP version 5.6 and later, or numeric strings can be passed to the function provided that it is possible to convert those strings to numbers.
Return Value : This function returns a GMP number which is the remainder of the division.
Input : $num1 = 146, $num2 = 12 Output : 2 Input : $num1 = "189126457831", $num2 = "12098123409" Output : 7654606696
Below programs will illustrate the use of gmp_div_r() function.
Program 1 : Program to perform the division of GMP numbers when GMP numbers are passed as arguments.
Program 2 : Program to perform the division of GMP numbers when numeric strings as GMP numbers are passed as arguments.
Reference : http://php.net/manual/en/function.gmp-div-r.php
This article is attributed to GeeksforGeeks.org