I need to be able to read the number of apiaccountview_id inside the array of this response:
{
"errorCodes": null,
"result": {
"apiaccountview_id": "553631",
"apiaccountview_countryId": "UA",
"apiaccountview_registrationIp": "531137938",
"apiaccountview_phoneNumber": "12344512344"
},
"success": true
}
I am using
$obj = json_decode($response,true);
And I want to have this to show the apiaccountview_id
if ($obj['success'] =='true'){
return array(
'error' => 0,
'msg' => "added successfully - " . $obj['result=>apiaccountview_id'] . ":" . $obj['result=>apiaccountview_id']
);
}
else{
return array(
'error' => 1,
'msg' => "Error in loading - " . $obj['errorCodes'] . ":" . $obj['result']
);
}
Since result is an array I was thinking on calling the value inside like this:
$obj['result=>apiaccountview_id']
But it didn't work. Can you please help me understand why? How can I get a value inside an json array?
Thank you, Arye