Hi! Could we please enable some services and cookies to improve your experience and our website?

PHPize Online / SQLize Online  /  SQLtest Online

A A A
Login    Share code      Blog   FAQ

Online Sandbox for SQL and PHP: Write, Run, Test, and Share SQL Queries and PHP Code

Copy Format Clear

Stuck with a problem? Got Error? Ask AI support!

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){ $wind1=[$v['dt']] = $v['wind']['speed']; $wind2[]=[ 'dt'=$v['dt'], 'speed'=>$v['wind']['speed'] ]; } rsort(wind1); usort($wind2,function($a,$b){ return $b['speed']<=>$a['speed']; }); echo"wind2 date: ".date('d.m.Y H:i',$wind2[0]['dt'])."speed:".$wind2[0]['speed'];
Copy Clear