I have this array
Array
(
[result] => Array
(
[status] => nok
[reason] => Character not found.
)
[code] => 404
[content_type] => application/json;charset=utf-8
)
I want to check the [status], if it is "nok" it should appear "Match found".
My code:
$info = $r['result']['status'];
if (in_array("nok", $info))
{
echo "Match found";
}
else
{
echo "Match not found";
}
?>
$r['result']['status']this is not an array . u can chk likeif($info == 'nok')if (in_array("nok", $info)){needs to beif ($info === "nok"){if (in_array("nok", $r['result'])){you can use this tooif (in_array("nok", $info)){needs to beif ($info === "nok"){orif (in_array("nok", $r['result'])){you can use this too