PHP gmp_gcd() FunctionPHP language uses the gmp_gcd() mathematical function to figure out the greatest common divisor of a GMP parameter. This function displays the GCD value in a single line. SyntaxThe given syntax shows the required data for PHP gmp_gcd() function. Parameters
Return ValuesThis function gives back a GMP number as an output that is the largest common divisor of the parameter. ExamplesThe given examples show the greatest common divisor of the different types of GMP parameters. Example1: the given example shows a GCD operation with given GMP parameters. Here, we can use the numerical number to find the largest common divisor number. Output: The following output image shows gmp_gcd() functions value. Example2: the given example shows a GCD operation with given GMP parameters. Here, we can use the negative number to find the largest common divisor number. The negative number displays the same greatest common divisor as a positive number. Output: The given output image shows gmp_gcd() functions value. Example3: the given example shows a GCD operation with given GMP parameters. Here, we can use the numerical variable to find the greatest common divisor. Output: The following output image shows gmp_gcd() functions value. Example4: the given example shows the greatest common divisor operation with given GMP parameters. Here, we can use the non-divisible GMP input numbers. Output: The following output image shows gmp_gcd() functions value. the output shows the "1" value for the non-divisor number. Example5: the given example shows the greatest common divisor operation with given GMP parameters. Here, we can use other GMP function with the input numbers. The example uses add function with variable values and uses in the GCD function./p> Output: The given output image shows gmp_gcd() functions value. ConclusionThe gmp_gcd() function uses mathematical operations to get the greatest common divisor. This function helps to reduce code size using a single function and gets output easily.
Next TopicPHP gmp_import() Function
|