I need to go through this array and extract the data heartRate and deviceNumber in separate variables.
{
"bodys": {
"bikeArrays": [],
"heartRateArrays": [
{
"heartRate": "88",
"deviceNumber": "302831"
}
]
},
"status": 1
}
El codigo que estoy utilizando es el siguiente:
$url = 'http://localhost:8090/rc900/openapi/datas?deviceNumbers=302831';
//me devuelve el array de arriba
$json = file_get_contents($url);
$obj = json_decode($json);
$datos = $obj->bodys->heartRateArrays;
echo json_encode($datos);
?>
obtengo como resultado cuando hago echo json_encode($datos);
[{"heartRate":"58","deviceNumber":"302831"}]
I would like to know how to go over the result above to put it in two separate variables