gmp_div_qr is a function in PHP that returns the remainder and quotient after dividing the numbers.
gmp_div_qr(GMP|int|string $number1, GMP|int|string $number2, int $rounding_mode = GMP_ROUND_ZERO): array
number1: The number that is going to be divided.
number2: The number that number1 is divided by.
number1andnumber2can be a GMP object, integer, or numeric string.
rounding_mode: The resultant rounding is defined by the rounding_mode. This can take the values listed below:
GMP_ROUND_ZERO: The result is truncated towards 0.
GMP_ROUND_PLUSINF: The result is rounded towards positive infinity.
GMP_ROUND_MINUSINF: The result is rounded towards negative infinity.
The function returns the remainder and quotient after dividing the numbers.
The value returned is of array type. The 1st element of the array will be the quotient, and the 2nd element of the array will be the remainder.
<?php//gmp_init is used to create GMP number$val1 = gmp_init(257);$val2 = gmp_init(17);$result = gmp_div_qr($val1, $val2);print_r($result);?>
Array 
( 
[0] => GMP Object ( [num] => 15 ) 
[1] => GMP Object ( [num] => 2 ) 
)