There is a major rich-poor divide in Vietnam these days: people in high-income areas continue to have a much better chance of living longer than those in low-income area. For example, a boy born in 2012 in a high-income area can expected to live to the age of around 76, which is 16 years longer than a boy born in a low-income area. For girls, the gap is wider - 19 years separates life expectancy in high-income (82 years) and low-income areas (63 years). So there is a corresponding uptick in life expectancy if the income is higher.
Problem: Get below array for example. $status = array ( "message" => "error" , "club_id" => $_club_id , "status" => "1" , "membership_info" => array (), ); This array will be encoded in json format echo json_encode($status); This function return json: {"message":"error","club_id":275,"status":"1","membership_info": [] } Notice the empty array [], it is not consistent, it should be an empty object {} {"message":"error","club_id":275,"status":"1","membership_info": {} } The cause: This problem is caused by the called function array(), which yields an empty array [] Solution: There are 2 solutions for this issue: Solution 1: Call new stdClass instead of array(), stdClass generates an empty object {} Solution 2: The above solution is complex in case there are plenty of arr...
Comments
Post a Comment