<?php

function diff_date($date1, $date2){
$an = substr("$date1", 0, 4);
$mes = substr("$date1", 5, 2);
$dia = substr("$date1", 8, 2);

$an2 = substr("$date2", 0, 4);
$mes2 = substr("$date2", 5, 2);
$dia2 = substr("$date2", 8, 2);

$timestamp = mktime(0, 0, 0, $mes, $dia, $an);
$timestamp2 = mktime(0, 0, 0, $mes2, $dia2, $an2);
$diff = floor(($timestamp - $timestamp2) / (3600 * 24));
return $diff;
}
?>
