Category Archives: computer science

PHP: XOR swap

The XOR swap lets you swap the value of integer variables without using a temporary variable, it's also slightly faster.
PLAIN TEXT
PHP:

$x ^= $y;

$y ^= $x;

$x ^= $y;

I can't actually think of a good reason Why you'd want to use this in PHP since memory isn't normally a big issue, however it might be good [...]