| Explanations to the above examples: ``` !$b ``` The ¡ is a boolean not, which requires a boolean value. To get one from any value, it checks if value is truthy or not:
- false and undef become false
- and all other values become true
The ! (not) operator then inverts the boolean
For the XOR operation
It does not matter if booleans are inverted or not since we are only concerned about values being different - i.e. the same result is obtained for true != false as for false != true. As an extra: if you want a boolean reflecting the "truthy value" you can do !!$a, which first converts to inverted boolean and then inverts that to reflect the "truthyness" of the value. |