The gmp_xor()
function in PHP is used to find the bitwise XOR of the given two numbers.
Note: You can learn more about the bitwise XOR operator here.
gmp_xor(GMP|int|string $num1, GMP|int|string $num2): GMP
num1
: This is a GMP object, integer, or a string.num2
: This is a GMP object, integer, or a string.The method returns the bitwise XOR of num1
and num2
.
<?php$num1 = gmp_init(5);$num2 = gmp_init(3);$xor = gmp_xor($num1, $num2);print "5 ^ 3 = ".$xor;?>
num1
.num2
.num1
and num2
using the gmp_xor()
method.