PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?php $token = "523df554f4e883874873853b897b6da0"; $lat = "59.436"; $lon = "24.753"; $url = "https://api.openweathermap.org/data/2.5/forecast?lat=$lat&lon=$lon&appid=$token"; $data=json_decode(file_get_contents($url), true); //$tempKelvin=$data["list"]["0"]["main"]["temp"]; //$tempCel=$tempKelvin-273.15; //$dt=$data["list"]["0"]["dt"]; //date_default_timezone_set('Europe/Tallinn'); //$time = date("d.m.Y H:i", $dt); $temp=$data["list"]; $slice = array_slice($temp, 0, 40); $result = array_sum($slice) / sizeof($slice); print_r($result);
Show:  
Copy Clear