echo (true == -1 ? "I'm a little bit surprising" : "Life is easy");
gives
I'm a little bit surprising
May someone explain me why is -1 equal to true? Thank you
echo (true == -1 ? "I'm a little bit surprising" : "Life is easy");
gives
I'm a little bit surprising
May someone explain me why is -1 equal to true? Thank you
Just read the manual, it says:
When converting to bool, the following values are considered false:
Every other value is considered true (including any resource and NAN).