Reputation: 151
$json = array("status" => 1, "msg" => "Done");
$json .=array("mailid" => $row["mailid"], "usertype" => $row["user_type"]);
echo json_encode($json,JSON_FORCE_OBJECT);
But i am getting "Array Array" as output.
Upvotes: 0
Views: 46
Reputation: 1167
You can't use string concatenation(.) operation for array, user array_merge instead
Please try like this
$json = array("status" => 1, "msg" => "Done");
$json_full= array_merge($json,array("mailid" => $row["mailid"], "usertype" => $row["user_type"]));
echo json_encode($json_full,JSON_FORCE_OBJECT);
Upvotes: 1