3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date1 = new DateTime('2017-03-01', new DateTimeZone('UTC')); $date2 = new DateTime('2017-04-01', new DateTimeZone('UTC')); $diff = $date1->diff($date2); echo "{$diff->m} months and {$diff->d} days.";
based on K2j28
Output for 5.6.0 - 5.6.30, hhvm-3.12.14 - 3.17.3, 7.0.0 - 7.2.6
1 months and 0 days.