I am trying to write a function that can count the number of days between 2 dates. I currently have the below but it is giving me some unexpected results:
functi
You can also use this (for versions PHP 5.1.5 and above without using date_diff()):
function dayCount($from, $to) { $first_date = strtotime($from); $second_date = strtotime($to); $days_diff = $second_date - $first_date; return date('d',$days_diff); } print dayCount($s, $e).' Days';