gmp_and() function in PHP


The gmp_and() function computes the bitwise AND of two GMP numbers.

Syntax

gmp_and($n1, $n2)

Parameters

  • n1 − The first GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

  • n2 − The second GMP number. It can be GMP object in PHP version 5.6 and later. Can also be numeric strings.

Return

The gmp_and() function returns the result as a GMP number.

Example

The following is an example −

<?php
   $n1 = "12";
   $n2 = "25";
   $a = gmp_and($n1, $n2);
   echo $a;
?>

Output

The following is the output −

8

Updated on: 30-Jun-2020

23 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements