Computer >> Computer tutorials >  >> Programming >> PHP

gmp_xor() function in PHP


The gmp_xor() function calculates the XOR of 2 GMP numbers.

Syntax

gmp_xor( 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_xor() function returns the XOR of the 1st and 2nd number.

Example

The following is an example:

<?php
   $res = gmp_xor("1", "2");
   echo $res;
?>

Output

The following is the output:

3