Do you want to show the difference between the photo and the one before it? You'll need to keep an array of dates you've already outputted:
$dates = array();
foreach($sql->query($get_photos) AS $photo) {
echo $photo['exif_taken'];
$original_date = $photo['exif_taken'];
if(!in_array($original_date, $dates))
$dates[] = $original_date;
// get the difference between this and the previous
if(count($dates) > 1) {
$last_key = count($dates) - 1;
$previous_date = $dates[$last_key - 1];
$timestamp_difference = strtotime($original_date) - strtotime($previous_date);
$difference_in_days = floor($timestamp_difference/(60*60*24));
echo $difference_in_days . ' days after previous entry';
}
}
If your exif_taken
variable contains more than just dd/mm/yyyy format, you'll probably want to make it dd/mm/yyyy so that it will match up in the array:
$original_date = date('d/m/Y', strtotime($photo['exif_taken']));