PHP gmp_div_q() Function

The division operation uses in the web application without mathematical operators and functionalities. PHP language has a built-in function called gmp_div_q() that is used for dividing the two figures. Here, we cannot use decimal numbers using a simple function, but it works on negative values also.

Syntax

The following syntax shows the GMP division's function.

Parameters

  • The above syntax shows that this function uses two values as input GMP parameters.
  • This function uses two parameters as a resource and gives the output of the division function.
  • The GMP function requires two parameters to get the quotient of the operation. It can work with other GMP functions, like the init function.

Return Value:

This function gives a quotient value of the two numerical data. It is a numerical value displayed as an output for division operation.

Examples

The following examples show the division of the GMP parameters.

Example1: the following example shows a basic division function with value. The parameter uses positive data with simple values.

Output:

The following output shows the division of the value.

PHP gmp_div_q() Function

Example2: the following example shows the summation of positive and negative values with value. The parameter uses one positive value and a second negative value with a divisional function.

Output:

The following image shows the division operation with a quotient value.

PHP gmp_div_q() Function

Example3: the following example shows a basic division operation with negative values. The absolute function uses the sum of data to get the actual value.

Output:

The following output shows the GMP division function.

PHP gmp_div_q() Function

Example4: the following example shows basic division functions with value. The parameter uses variable values for the division function.

Output:

The following output shows the division operation and its value.

PHP gmp_div_q() Function

Example5: the following example shows a basic division function with the gmp_init() function.

Output:

The following output shows the division operation and its value.

PHP gmp_div_q() Function

Conclusion

The division "gmp_div_q()" function uses to get quotient of two numbers using PHP GMP values. The function removes lengthy division operations code using operators and values.






Latest Courses