gmp_div_q() function in PHP


The gmp_div_q() function performs division of GMP numbers

Syntax

gmp_div_q(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_q() function returns the quotient when n1 is divided by n2. The output is itself a GMP number.

Example

The following is an example −

<?php
   $n1 = "14";
   $n2 = "2";
   $res = gmp_div_q($n1, $n2);
   echo $res;
?>

Output

The following is the output −

7

Updated on: 30-Jun-2020

28 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements