Hi! Could we please enable some services and cookies to improve your experience and our website?
Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code
<?php
$apikey="523df554f4e883874873853b897b6da0";
$city="Onitsha";
$url="https://api.openweathermap.org/data/2.5/forecast?q=$city&appid=$apikey";
$json=file_get_contents($url);
$data=json_decode($json,true);
$wind1=[];
$wind2=[];
$wind3=[];
foreach($data["list"] as $v){
$wind2[]=[
"dt"=>$v["dt"],
"speed"=>$v["wind"]["speed"]
];
}
usort($wind2,function($a,$b){
return $a["speed"]<=>$b["speed"];
});
echo "wind2 date ".date("d.m.Y H:i",$wind2[0]["dt"])."speed"$wind2[0]["speed"];
print_r($wind2);
rsort($wind1);
print_r($wind2);exit();