getWeatherForecast('Berlin', $units, $lang, '', 10); echo "EXAMPLE 1
\n\n\n"; echo "City: " . $forecast->city->name; echo "
\n"; echo "LastUpdate: " . $forecast->lastUpdate->format('d.m.Y H:i'); echo "
\n"; echo "Sunrise : " . $forecast->sun->rise->format("H:i:s") . " Sunset : " . $forecast->sun->set->format("H:i:s"); echo "
\n"; echo "
\n"; foreach ($forecast as $weather) { // Each $weather contains a Cmfcmf\ForecastWeather object which is almost the same as the Cmfcmf\Weather object. // Take a look into 'Examples_Current.php' to see the available options. echo "Weather forecast at " . $weather->time->day->format('d.m.Y') . " from " . $weather->time->from->format('H:i') . " to " . $weather->time->to->format('H:i'); echo "
\n"; echo $weather->temperature; echo "
\n"; echo "---"; echo "
\n"; } // Example 2: Get forecast for the next 3 days for Berlin. $forecast = $owm->getWeatherForecast('Berlin', $units, $lang, '', 3); echo "EXAMPLE 2
\n\n\n"; foreach ($forecast as $weather) { echo "Weather forecast at " . $weather->time->day->format('d.m.Y') . " from " . $weather->time->from->format('H:i') . " to " . $weather->time->to->format('H:i') . "
"; echo $weather->temperature . "
\n"; echo "---
\n"; }