Computer >> Computer tutorials >  >> Programming >> PHP

gmp_div_r() function in PHP


The gmp_div_r() function is used to calculate the division operation between two GMP numbers.

Syntax

gmp_div_r(n1, n2)

Parameters

  • n1 − The first GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

  • n2 − The second GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

Return

The gmp_div_r()function returns the remainder of the division.

Example

The following is an example −

<?php
   $n1 = gmp_init(119);
   $n2 = gmp_init(14);
   $a = gmp_div_r($n1, $n2);
   echo $a;
?>

Output

The following is the output −

7