PHPize Online / SQLize Online  /  SQLtest Online

A A A
Share      Blog   Popular
Copy Format Clear
Copy Clear
Copy Format Clear
<?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();
Show:  
Copy Clear