$a ^= $b

Binary xor assignment

Apply a binary "xor" operation and assign the first variable to the result.

Tags
// Binary representation: 1100
$a = 12; 

// Binary representation: 1010
$b = 10; 

// Binary representation 0110:
// 1 XOR 1 = 0
// 1 XOR 0 = 1
// 0 XOR 1 = 1
// 0 XOR 0 = 0
$a ^= $b;

null coalescing

What is this? Who are you!?

PHP Operators is a reference guide for operators old and new in the PHP programming language. We're SPATIE, a web development agency from Belgium. Besides client work we like to contribute to the open source community and make fun projects like this one.