PHP gmp_mod() FunctionThe modulus is given as an output by the GMP gmp_mod() function. This function calculates the modulo of two GMP numbers. Modulo is an operation in math that finds the number left over after dividing one integer by another. It is often written as a mod or shown by the percentage (%) symbol. SyntaxThe following syntax shows the gmp_mod() function and its operation. Parameters
Return ValueThe function gives back a GMP number, which is same as modulo ($number % $d). ExamplesThe following examples show modulo operation using a function with various parameters. Example1: the given an example uses the gmp_mod() with the essential and positive values. Output: The image shows the "Modulo value" of the given two values. Example2: the given example uses the gmp_mod() with the positive and negative values. Output: The image shows the "Modulo value" of the given two values. Example3: the given example uses the gmp_mod() with the variable values. Output: The image shows the "Modulo value" of the given value. Example4: the following example shows the gmp_mod() function with the GMP parameter and its value. We can use absolute, init, and other GMP functions data. Output: The image shows the "Modulo value" of the given two values. ConclusionThe gmp_mod() function gives modulo of the value without mathematical operation. It is used for mathematical functions without lengthy and complicated processes. Next TopicPHP gmp_prob_prime() function |