boolean toggle
While exploring Tumblr, I saw the following post:
…when switching don’t mind using:
if ($val==0) $val = $1; else $val = 0;instead use:
$val = abs ($val-1);
It’s ok (except the $1 typo); but the following solution is far more efficient:
$val ^= 1;
I saw the post and wanted to leave a comment; but I couldn’t. That’s why I’m posting this. :)