Javatpoint Logo
Javatpoint Logo

PHP gmp_xor() function

PHP language provides mathematical or logical GMP function called gmp_xor() with essential parameter. The gmp_xor() function works to calculate a bitwise XOR comparison or value between two numbers. The function works for logical operation for two numerical input values.

Syntax

The syntax shows how to operate the GMP bitwise XOR function.

Parameters

  • The syntax shows two input parameters for the "XOR" function.
  • The two parameters are numeric, binary, integer, and string values converted into numbers.

Return Value

This function gives an XOR value of the two values. It is the XOR comparison number of the input value as an output.

Examples

The examples show the "XOR" calculation using the two GMP parameters in a function.

Example1: the given an example calculates bitwise "XOR" function with given value. The function uses a basic numeric value as a parameter.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Example2: the following example compares the two values using the "XOR" operator. The input parameter uses negative numbers to get a bitwise "XOR" operation.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Example3: the following example compares the two values using the "XOR" operator. The input data uses various variables as parameters with the "XOR" function.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Example4: the following example shows the bitwise operation of the two values using the "XOR" operator. This function uses a variable, another GMP function with the "gmp_xor" function.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Example5: the following example shows the "gmp_xor" with the "gmp_init" function. Here, we use binary data as input parameters.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Example6: the following example shows the "gmp_xor" with the other GMP function. Here, we use string values as input parameters.

Output:

The following output shows bitwise "XOR" comparison value.

PHP gmp_xor() function

Conclusion

The "gmp_xor()" function compares two parameters with bitwise XOR operation. It is a logical operation with numeric GMP parameters.


Next Topic#





Youtube For Videos Join Our Youtube Channel: Join Now

Feedback


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA