I want to get the total of months between two dates. My code is returning 0
rather than 10 * 12
. Why isn't it working and how do I fix it?
Code:
$date1 = new DateTime("2015-02-14");
$date2 = new DateTime("2025-02-14");
var_dump($date1->diff($date2)->m); // output 0