php - comapring with boolean using triple equals for result set of mysql query -
this question has answer here:
- the 3 different equals 9 answers
why using triple equals here compare ?
if ($conn->query($sql) === true) { echo "new record created successfully"; }
many php functions may return mixed types, unlike many other languages. if compare ==
, values tested. therefore non-zero value equal true, , things 123 == '123abc'
true.
the ===
operator requires types same also, object not equal true , 123 === '123'
doesn't equal true.
Comments
Post a Comment