• PHP Video Tutorials

PHP - gmp_divexact() Function



Definition and Usage

The gmp_divexact() function gives exact division of numbers.

Description

gmp_divexact() divides the number given and returns a GMP number.

Syntax

gmp_divexact ( GMP $a , GMP $b ) : GMP

Parameters

Sr.No Parameter & Description
1

a

The number to be divided.It can a GMP resource number , a gmp object or a numeric string .

2

b

The number that you will divide with parameter a. It can a GMP resource number , a gmp object or a numeric string .

Return Values

PHP gmp_divexact() function divides the numbers given and returns a GMP number.

PHP Version

This function will work from PHP Version greater than 5.0.0.

Example 1

Working of gmp_divexact −

<?php
   $div1 = gmp_divexact("8", "4");
   echo "The value is :".$div1;
   echo "<br/><br/>";
   $div2 = gmp_divexact("11", "2"); 
   echo "The value is : " .$div2."\n";
?>

This will produce following result −

The value is :2
The value is : 5

Example 2

Working of gmp_divexact with hexadecimal numbers −

<?php
   $div1 = gmp_divexact("0xFF", "0x80");
   echo "The value is :".$div1;
?>

This will produce following result −

The value is :1
php_function_reference.htm
Advertisements