Why does php say me 'DEP $925'==0.0 is true?
Can anybody point me to a source for a general rule which covers this case?
—
edit: sorry, initially pasted wrong expression: 'DEP $925'=='' which, doesn’t evaluate to true. Please see now above
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since you’re comparing two different data types, PHP will cast one type into the other. In this case, it’s casting the string to a float. It won’t extract the ‘925’ in there. It’ll see the string starts with a
D, which is not a number, so the string becomes0, which is0.0float, and compares as equal.