3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d1 = new DateTime('2016-05-01'); $d2 = new DateTime('2016-10-01'); $d3 = new DateTime('2016-11-01'); echo($d1->diff($d2)->m . "\n"); echo($d2->diff($d3)->m . "\n"); echo($d1->diff($d2)->d . "\n"); echo($d2->diff($d3)->d . "\n");
based on cmgP7
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.6
5 1 0 1