on-internet
← Community

How does PHP treat different values in a Boolean context?

Stack Overflow ·

How does PHP handle true/false comparison internally? I understand that true is defined as 1 and false is defined as 0. When I do if ("a") { echo "true";}, it echos "true". How does PHP recognize "a" as 1?

Comments

Sign in or sign up to comment and upvote.

No comments yet.