The gmp_and() is an inbuilt function in PHP which is used to calculate the bitwise AND of two GMP numbers(GNU Multiple Precision : For large numbers).
Parameters: This function accepts two GMP numbers, $num1, $num2 as mandatory parameters as shown in the above syntax. These parameters can be GMP objects in PHP version 5.6 and later, or we are also allowed to pass numeric strings such that it is possible to convert those strings to numbers.
Return Value: This function returns a GMP number which is bitwise AND of GMP numbers passed to it as parameters.
Input : gmp_and("4", "2") Output : 0 Input : gmp_and("9", "10") Output : 8
Below programs illustrate the gmp_and() function in PHP:
Program 1: Program to calculate the bitwise AND of GMP numbers when numeric strings as GMP numbers are passed as arguments.
Program 2: Program to calculate the bitwise AND of GMP numbers when GMP numbers are passed as arguments.