Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
It's essentially a condensed and time-efficient way to swap the integer values of two variables. The $a ^= $b assignment operator is the short-hand version of $a = $a ^ $b, while ^ is the operator for the bitwise XOR function. The reason it works is deeply rooted in the XOR function's property of forming distinct hybrids of two parameters that allow the reconstruction of each parameter if the hybrid is known (which is why it was once popular in simple encryption). Read a good and longer explanation here: https://betterexplained.com/articles/swap-two-variables-using-xor/
However, above solution was only chosen for brevity and is not suitable for deployment as it's not quite readable and comes with caveats such as it's only properly working for integers. If you put in strings of different lengths, it will produce scrambled versions of them but not the proper ones.