gmp_legendre() function calculates the Legendre sign of two GMP numbers.
It returns -
- GMP Number- PHP 5.5 and earlier, or
- GMP Object- PHP 5.6 and later
gmp_legendre(n1, n2)
n1 - First GMP number. Can be a GMP object in PHP 5.6 and higher. Can also be a numeric string.
n2 - Second GMP number. Can be a GMP object in PHP 5.6 and higher. Can also be a numeric string.
gmp_legendre() function returns the GMP number or object.
The following is an example-
<?php $n1 = 5; $n2 = 5; echo gmp_legendre($n1, $n2); ?>
The following is the output-
0
Let’s see another example –
<?php $n1 = 4; $n2 = 3; echo gmp_legendre($n1, $n2); ?>
Below is the output –
1
The above is the detailed content of gmp_legendre() function in PHP. For more information, please follow other related articles on the PHP Chinese website!