PHP - gmp_xor() Function
Definition and Usage
The gmp_xor() function calculates the bitwise XOR of the given numbers.
Description
The gmp_xor() calculates the bitwise exclusive OR i.e. XOR for the given two GMP numbers.
Syntax
gmp_xor ( GMP $a , GMP $b ) : GMP
Parameters
| Sr.No | Parameter & Description |
|---|---|
| 1 |
a It can a GMP resource number , a gmp object or a numeric string. |
| 2 |
b It can a GMP resource number , a gmp object or a numeric string. |
Return Values
PHP gmp_xor() function returns GMP number.
PHP Version
This function will work from PHP Version greater than 5.0.0.
Example 1
Working of gmp_xor() −
<?php
$xor1 = gmp_xor("0xffeffcd", "16");
$num1 = gmp_strval($xor1, 2);
echo "The result is :".$num1;
?>
This will produce following result −
The result is :1111111111101111111111011101
Example 2
Working of gmp_xor() −
<?php
$xor1 = gmp_xor("0xffeffcd", "16");
$num1 = gmp_strval($xor1, 8);
echo "The result is :".$num1;
?>
This will produce following result −
The result is :1777577735
php_function_reference.htm
Advertisements