I want to count the days in a date, the sample code that I use as below
<?php
$birthDate = "12-8-2018"; ( m-d-Y)
$birthDate = explode("-", $birthDate);
$age = (date("md", date("U", mktime(0, 0, 0, $birthDate[0], $birthDate[1], $birthDate[2]))) > date("md")
? ((date("Y") - $birthDate[2]) - 1)
: (date("Y") - $birthDate[2]));
echo "Age is:" . $age; // OUTPUT is -1
?>
the results I get are only in the form of years, how do I get results in the form of the number of days, an example for the results in the code above should be 19