@ 2015-12-11T16:41:21Z <?php
$request = 'http://api.openweathermap.org/data/2.5/group?id=4880731,5000598,5128581,5368361,4887398,5391811,4930956,1275339,1273294,1275004,1264527,524901,703448,2643743,1816670,292223&APPID=ea2cc999e9e272185de78f08e2e738fc';
$response = file_get_contents($request);
$data=json_decode($response,true);
>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset = "UTF-8" />
<meta name="author" content="Chaitanya" />
<meta name="keywords" content="countries, country id" />
<link rel="stylesheet" type="text/css" href="style.css" />
<title>PHP Application</title>
</head>
<body>
<div class = "main-wrap">
<h2>PHP Web Assignment Task</h2>
<hr /><br />
<form action="index.php" method="post">
<pre>Name: <input type="text" name="name"/> Country: <input type="text" name="country"> <input type="submit" name="filter" value="Filter"></pre>
<br><br>
</form>
Search Term:<br />
<pre>Name: <?php echo $_POST['name']; ?>
Country: <?php echo $_POST['country']; ?>
</pre>
<br />
<table border="1" cellspacing="5" width="100%" style="text-align: center">
<tr>
<th>ID</th>
<th>Name</th>
<th>Country</th>
</tr>
<?php
$count = $data['cnt'];
$country;
if($_POST['filter']){
if($_POST['country']){
$country = $_POST['country'];
for($i = 0; $i < $count; $i++){
if($data['list'][$i]['sys']['country'] == $country){
echo "<tr>";
echo "<td>".$data['list'][$i]['id']."</td>";
echo "<td>".$data['list'][$i]['name']."</td>";
echo "<td>".$data['list'][$i]['sys']['country']."</td>";
echo "</tr>";
}
else continue;
}
}
if ($_POST['name']) {
$name = $_POST['name'];
for($i = 0; $i < $count; $i++){
if($data['list'][$i]['name'] == $name){
echo "<tr>";
echo "<td>".$data['list'][$i]['id']."</td>";
echo "<td>".$data['list'][$i]['name']."</td>";
echo "<td>".$data['list'][$i]['sys']['country']."</td>";
echo "</tr>";
}
else continue;
}
}
}
else{
for($i = 0; $i < $count; $i++){
echo "<tr>";
echo "<td>".$data['list'][$i]['id']."</td>";
echo "<td>".$data['list'][$i]['name']."</td>";
echo "<td>".$data['list'][$i]['sys']['country']."</td>";
echo "</tr>";
}
}
?>
</table>
</div>
</body>
</html>
Enable javascript to submit You have javascript disabled. You will not be able to edit any code.
Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).
Version System time (s) User time (s) Memory (MiB) 7.0.0 0.010 0.067 20.16 5.6.16 0.003 0.087 20.57 5.6.15 0.007 0.060 18.19 5.6.14 0.013 0.063 18.14 5.6.13 0.003 0.090 18.14 5.6.12 0.013 0.063 20.99 5.6.11 0.010 0.083 21.11 5.6.10 0.003 0.043 20.97 5.6.9 0.013 0.060 21.00 5.6.8 0.007 0.083 20.40 5.5.30 0.007 0.043 17.95 5.5.29 0.010 0.037 18.01 5.5.28 0.020 0.073 20.77 5.5.27 0.003 0.053 20.74 5.5.26 0.010 0.087 20.79 5.5.25 0.007 0.073 20.65 5.5.24 0.010 0.033 20.36
preferences:dark mode live preview
140.95 ms | 1394 KiB | 7 Q