Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
BigBoo23206yCongratulations!
I sometimes do a double XOR just to throw off whomever is reading my code. -
If you like using xor that much, you could try the cryptopals coding challenges ^_^
-
Use case:
I wanted to sort an array by its keys, some keys were strings, some integers. I needed to sort them ascending, which would place the numerical indexes before the steering indexes. But I needed the numerical indexed after the string indexes.
So this is my compare function:
function ($keyA, $keyB) {
if(is_numeric($keyA) xor is_numeric($keyB)) {
return $keyB <=> $keyA;
}
return $keyA <=> $keyB;
} -
Here in Germany, all major hosters charge extra for legacy php 5 support. That makes it pretty easy to convince my clients to upgrade.
-
Am I the only one who uses bitwise operators all the time? They are super useful, and at least for xor and cryptography, required many times. But even "and" and "or" are super useful!
Related Rants
It happened! It finally happened.
I got to use the XOR operator today, for the first time in my 10 years of development.
Now I feel complete. I am senior developer now!
rant
xor