Home > PHP > Function > GMP > gmp_div_qr()

gmp_div_qr()

gmp_div_qr - Divide numbers and get quotient and remainder

Syntax

array gmp_div_qr (resource $n, resource $d, int $round)

Arguments

  • n - The number being divided. It can be either a GMP number resource, or a numeric string given that it is possible to convert the latter to a number.
  • d - The number that n is being divided by. It can be either a GMP number resource, or a numeric string given that it is possible to convert the latter to a number.
  • round - See the gmp_div_q() function for description of the round argument.

Description

The function divides n by d.

Version

PHP 4.0.4, 5

Return value

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