src/Carbon/Traits/Difference.php
public function diffInMonths($date = null, $absolute = true)
    {
        $date = $this->resolveCarbon($date);

        return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m');
    }
public function diffInMonths($date = null, $absolute = true)
    {
        $date = $this->resolveCarbon($date);

        return $this->diffInYears($date, $absolute) * static::MONTHS_PER_YEAR + (int) $this->diff($date, $absolute)->format('%r%m');
    }
public function diffInMonths ( $ date = null , $ absolute = true ) { $ date = $ this -> resolveCarbon ( $ date ) ; return $ this -> diffInYears ( $ date , $ absolute ) * static :: MONTHS_PER_YEAR + ( int ) $ this -> diff ( $ date , $ absolute ) -> format ( '%r%m' ) ; }
Get the difference in months

@param Carbon|\DateTimeInterface|string|null $date
@param bool                                  $absolute Get the absolute of the difference

@return int
Get the difference in months