I've been trying to figure this one out for hours but to no avail: how does one get the difference in full months between two dates, yet accounting for year? The code below
$assignedDate = new DateTime('2011-02-03');
$firstDate = new DateTime('2013-03-03');
$interval = $assignedDate->diff($firstDate);
$months = (int)$interval->format('%m');
Is in the strong belief that the difference between the two is 1, however, this is not applicable for my application and 49 would be the expected result, I've investigated and found this code from this wonderful place but get "Wrong string concatenation operator", so I assumed the problem lay with their stringy output and put (int) ahead of the two, but got 0:
echo (($diff->format('%y') * 12) + $diff->format('%m')) . " full months difference";
Is there a reliable solution to finding the month difference between two dates accounting for the year?