A more elegant solution is to use DateTime and DateInterval.
<?php
// @link http://www.php.net/manual/en/class.datetime.php
$d1 = new DateTime('2011-09-01');
$d2 = new DateTime('2012-06-06');
// @link http://www.php.net/manual/en/class.dateinterval.php
$interval = $d2->diff($d1);
$interval->format('%m months');