Essayez ceci :
$from = new DateTime('February 28, 2015');
$to = new DateTime('April 1, 2015');
$months = 1 + ($to->format('Y') - $from->format('Y')) * 12 + $to->format('n') - $from->format('n');
echo $months ;
Essayez ceci :
$from = new DateTime('February 28, 2015');
$to = new DateTime('April 1, 2015');
$months = 1 + ($to->format('Y') - $from->format('Y')) * 12 + $to->format('n') - $from->format('n');
echo $months ;