Home > Backend Development > PHP Tutorial > gmp_legendre() function in PHP

gmp_legendre() function in PHP

WBOY
Release: 2023-09-05 20:06:01
forward
998 people have browsed it

gmp_legendre() function in PHP

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

Syntax

gmp_legendre(n1, n2)
Copy after login

Parameters

  • 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.

Return

gmp_legendre() function returns the GMP number or object.

Example< /h2>

The following is an example-

<?php
   $n1 = 5;
   $n2 = 5;
   echo gmp_legendre($n1, $n2);
?>
Copy after login

Output

The following is the output-

0
Copy after login

Example

Let’s see another example –

<?php
   $n1 = 4;
   $n2 = 3;
   echo gmp_legendre($n1, $n2);
?>
Copy after login

Output

Below is the output –

1
Copy after login

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!

source:tutorialspoint.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template