how are they? I ask you a question, I have the following code in php:
function getCotizacionDolar(){
$ch = curl_init();
$headers = [
'Content-Type: application/json',
'Authorization: BEARER eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE1NjkxOTAxMzUsInR5cGUiOiJleHRlcm5hbCIsInVzZXIiOiJhbGVqYW5kcm8zMDkwMUBnbWFpbC5jb20ifQ.oJisOihr0r0NA0_30hTiGiG1OiLmESAdF44uiDz60CcStW2IKU8jnD78eAdeC7SF60QCOWuFU_Rd9SFgX0hYkw'
];
curl_setopt($ch, CURLOPT_URL, 'http://api.estadisticasbcra.com/tasa_badlar');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
$respuesta = curl_exec($ch);
curl_close($ch);
$resultado = json_decode($respuesta, true);
}
What he basically does is bring me a json with the quote of the dollar of the day, the subject is the following, I only want the last value of that json file, how can I ask for the last data? or how can I go through the 120000 data that it brings me to obtain it? I try to go through it with a for, but it does not leave me because it tells me it is not an array. Would someone tell me how I can do it? then I leave what he returns (only part because it is very long):
[{"d": "2003-01-02", "v": 21.75}, {"d": "2003-01-03", "v": 18.375}, {"d": " 2003-01-06 "," v ": 18.1875}, {" d ":" 2003-01-07 "," v ": 14.6875}, {" d ":" 2003-01-08 "," v " : 13.4375}, {"d": "2003-01-09", "v": 10.5625}, {"d": "2003-01-10", "v": 8.9375}, {"d": " 2003-01-13 "," v ": 13.75}, {" d ":" 2003-01-14 "," v ": 11.6875}, {" d ":" 2003-01-15 "," v " : 14.3125}, {"d": "2003-01-16", "v": 13.8125}, {"d": "2003-01-17", "v": 13.5}, {"d": " 2003-01-20 "," v ": 14.3125}, {" d ":" 2003-01-21 "," v ": 13.8125}, {" d ":" 2003-01-22 "," v " : 16.3125}, {"d": "2003-01-23", "v": 12.9375}, {"d": "2003-01-24", "v": 10.5625}, {"d": " 2003-01-27 "," v ": 13.4375}, {" d ":" 2003-01-28 "," v ": 12.1875}, {" d ":" 2003-01-29 "," v " : 15.375}, {"d": "2003-01-30", "v": 12.9375}, {"d": "2003-01-31", "v": 11.4375}, {"d": " 2003-02-03 "," v ": 13.125}, {" d ":" 2003-02-04 "," v ": 15}, {" d ":" 2003-02-05 "," v " : 14.5625}]