PHPで配列を正しく解析するのに苦労しています。配列の出力は次のとおりです。
[{"address":"2801 Elliott Ave","category_ids":[347],"category_labels":[["Social","Food and
Dining","Restaurants"]],"country":"us","email":"kimd@thedussingroup.com","factual_id":"43cfe23
8-ae8e-469a-8592-a1edc8603051","fax":"(206) 448-
9252","latitude":47.615154,"locality":"Seattle","longitude":-122.353724,"name":"The Old
Spaghetti Factory","neighborhood":["Belltown","Downtown","Downtown
Seattle"],"postcode":"98121","region":"WA","tel":"(206) 441-
7724","website":"http:\/\/www.osf.com"}]
そして、これが解析の試みです...
$mark = array("[");
$mark2 = array("]");
$replacemark = array("");
$array = str_replace($mark, $replacemark, $array);
$array = str_replace($mark2, $replacemark, $array);
$array = stripslashes($array);
$obj = json_decode($array);
$address = $obj->{'address'};
$country = $obj->{'country'};
$factual_id = $obj->{'factual_id'};
$latitude = $obj->{'latitude'};
$locality = $obj->{'locality'};
$longitude = $obj->{'longitude'};
$name = $obj->{'name'};
$postcode = $obj->{'postcode'};
$region = $obj->{'region'};
$status = $obj->{'status'};
$tel = $obj->{'tel'};
これらの値が何も返さない理由はありますか? ありがとう!