This question already has an answer here:
- String compare on a bool 3 answers
- Understanding PHP Type Coercion 4 answers
Php Code:
$resData = array('result'=>true);
if($resData["result"] == "success")
echo "Success";
else
echo "Failure";
Above code work perfect, but confuse with condition $resData["result"] contain true so, actual condition we use for compare is like if($resData["result"] == true) or if($resData["result"]) but, here condition is if($resData["result"] == "success") and that run fine and give perfect result.
So, my question is how condition work fine with true == "success" ?
Aucun commentaire:
Enregistrer un commentaire