PHP.nl

gmp_div_qr

gmp_div_qr

Divide numbers and get quotient and remainder

array **gmp_div_qr**  $num1  $num2 int $rounding_mode

The function divides by . num1``num2

num1The number being divided.

num2 The number that is being divided by. num1

rounding_mode See the function for description of the argument. gmp_div_q``rounding_mode

Returns an , with the first element being (the integer result of the division) and the second being (the remainder of the division). array``[n/d]``(n - [n/d] * d)

Voorbeeld: Division of GMP numbers

<?php
$a = gmp_init("0x41682179fbf5");
$res = gmp_div_qr($a, "0xDEFE75");
printf("Result is: q - %s, r - %s",
       gmp_strval($res[0]), gmp_strval($res[1]));
?>

gmp_div_q``gmp_div_r