Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有约会
$d1='2014-02-01'; $d2='2013-11-01';
我想要如果我减去$d2 - $d1 = i get difference of month = -3如果$d1 - $d2 = 3,
$d2 - $d1 = i get difference of month = -3
$d1 - $d2 = 3
任何人都可以提供帮助,对不起我的英语不好
$d1= new DateTime('2014-02-01'); $d2= new DateTime('2013-11-01'); $diff = $d1->diff($d2); echo $diff->format("%r%m");
演示