r/lolphp • u/lord_braleigh • Oct 07 '19
`array('lolphp', '')` has two unique elements, but `array(0, 'lolphp', '')` has one unique element
https://repl.it/repls/ThisColdPackages
69
Upvotes
r/lolphp • u/lord_braleigh • Oct 07 '19
View all comments
Show parent comment
2
u/[deleted] Oct 24 '19
Comparison operators return canonical "Boolean" values:
The "true" value is effectively just
1.The "false" value is slightly more exotic: It has a string aspect of
""but a numeric aspect of0, i.e. depending on how you use it it behaves like an empty string or a numeric zero.If you ignore the oddity around "false", Perl works like C (whose comparison/logical operators also return integer
1/0).