I have a for each loop that loops through a set of lines each line has an installation date, but I only want to get the earliest installation date out of all the lines loop through, this could be any random line in the loop. How do I go about this? Should I just create an array of dates and then sort it or should I just check every time it loops? A code example would be best. The format of the date is simply: 2012-09-04
foreach($lines as $line){
$install_date = $line->installation_date_c;
$water_cost = $line->water_cost_c;
$energy_cost = $line->energy_cost_c;
$oweeks = 52;
$oyears = $line->operating_years_c;
$default_curr = $line->currency_id;
}