jeudi 28 juillet 2016

Confuse with If Condition in php [duplicate]

This question already has an answer here:

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