]> Stephen's Gitweb - reasonableweather.git/commitdiff
Round down fractions
authorStephen Jianu <stephen@stephenjianu.com>
Sun, 23 Mar 2025 21:19:30 +0000 (16:19 -0500)
committerStephen Jianu <stephen@stephenjianu.com>
Sun, 23 Mar 2025 21:19:30 +0000 (16:19 -0500)
index.php

index 8ee9bbf3efd9e2b4bef51a84b9ba69e6250e81eb..de0a177cd144f60a04af53164f0fba88e89de142 100644 (file)
--- a/index.php
+++ b/index.php
        $isDay = ($json["current"]["is_day"]) ? "day" : "night";
        $description = $jsonDescriptions[$code][$isDay]["description"];
        $image = $jsonDescriptions[$code][$isDay]["image"];
-       echo "<img src=\"".$image."\"/><br>".$description."<br>".$json["current"]["temperature_2m"]."&deg; F\n";
+       echo "<img src=\"".$image."\"/><br>".$description."<br>".floor($json["current"]["temperature_2m"])."&deg; F\n";
        echo "</h1>\n";
        echo "<h3>Your 7 day forecast for Park Ridge is:</h3>\n";
        for ($i = 0; $i < 7; $i++) {
                $code = $json["daily"]["weather_code"][$i];
                $description = $jsonDescriptions[$code]["day"]["description"];
                $image = $jsonDescriptions[$code]["day"]["image"];
-               $tempHigh = $json["daily"]["temperature_2m_max"][$i];
-               $tempLow = $json["daily"]["temperature_2m_min"][$i];
+               $tempHigh = floor($json["daily"]["temperature_2m_max"][$i]);
+               $tempLow = floor($json["daily"]["temperature_2m_min"][$i]);
                echo "<div style=\"min-width: 10%; display: inline-block;\">\n";
                echo "<h3>\n";
                echo "".date('l', strtotime($json["daily"]["time"][$i]))."<br><img src=\"".$image."\"/>\n";