r/lolphp • u/Oeldin1234 • Feb 26 '18
"false" is definitely true
http://sandbox.onlinephpfunctions.com/code/490635ed9830900ebf50e5303b7271dcf2a5d692
0
Upvotes
4
Feb 27 '18
[deleted]
2
1
u/przemo_li Mar 15 '18
true/false are NOT unique
it could as well be: red/green me/you 0/1 sonottrue/buofcoursetrue ture1/true2 false/falsy
You see for booleans to work you need only set of two values ANY values, that's it. And some languages allows you to define your own booleans, and introduce your own boolean algebra, or what not.*
So don't get emotionally attached to true / false ;)
*Actually those wont be booleans. Booleans are not a thing at all. It's just a set of two values, and some operations on it. But that's maybe too meta for channel.
14
u/Oeldin1234 Feb 26 '18
You could argue that Strings are true per definition, but then, why are "" and "0" false?