In response to harryjry and mehea concerning your Weather Model. The problem is that you don't need all the things you think you need. In OOP, good class definitions get to the point rather quickly.
<?php
class Weather{
public $time, $temperature, $humidity;
public function __construct($tm, $t, $h){
$this->time = $tm;
$this->temperature = $t;
$this->humidity = $h;
}
public function __toString(){
return "Time: $this->time,
Temperature: $this->temperature°,
Humidity: $this->humidity%";
}
}
$forecasts = array(
new Weather("1:00 pm", 65, 42),
new Weather("2:00 pm", 66, 40),
new Weather("3:00 pm", 68, 39)
);
echo "Forecast for Chicago, IL:<br>";
foreach($forecasts as $forecast) echo ' - ' . $forecast '<br>';
?>
Forecast for Chicago, IL:
- Time: 1:00 pm, Temperature: 65°, Humidity: 42%
- Time: 2:00 pm, Temperature: 66°, Humidity: 40%
- Time: 3:00 pm, Temperature: 68°, Humidity: 39%
Note: MySQL can store data like this already, but if you included constants, more variables, and other functions in the Weather class, then maybe, just maybe it could be of use.