PHP怎样计算两个日期相差几个月?
<br /> <?php<br /> function getMonthNum( $date1, $date2, $tags='-' ){<br /> $date1 = explode($tags,$date1);<br /> $date2 = explode($tags,$date2);<br /> return abs($date1[0] - $date2[0]) * 12 + abs($date1[1] - $date2[1]);<br /> }<br /> <br /> echo getMonthNum("2013-02-01","2014-01-01",'-');<br /> <br /> ?><br />