php - How to select value from JSON array -
i trying select variable array (at least think it's stored array):
$data = json_encode($response); file_put_contents('file.txt', $data);
gives
"status":200,"response":{ "api_id":"0f42d6be-8ed2-11e3-822e-22135", "bill_duration":36, "call_duration":36, "total_rate":"0.00300"} }
how can select call_duration
value (in php)? i've tried $response['call_duration']
, thought should work returns nothing?
$response['call_duration']
correct, think need:
$response['response']['call_duration']
looking @ output after converting json, think original array, $response
, looks (in php array format)
$response = array( 'status'=>200, 'response'=>array( 'api_id'=>'0f....etc', 'bill_duration'=>36, ... etc ) );
so, need go level deep array call_duration
.
Comments
Post a Comment