3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $d1 = \DateTime::createFromFormat('Y-m-d', '2017-07-07'); $d2 = new \DateTime('2016-09-25'); var_dump($d1->diff($d2));
based on FeAtK
Output for 7.1.0 - 7.2.6
object(DateInterval)#3 (16) { ["y"]=> int(0) ["m"]=> int(9) ["d"]=> int(12) ["h"]=> int(11) ["i"]=> int(30) ["s"]=> int(12) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(285) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.6.0 - 5.6.30, 7.0.0 - 7.0.20
object(DateInterval)#3 (15) { ["y"]=> int(0) ["m"]=> int(9) ["d"]=> int(12) ["h"]=> int(11) ["i"]=> int(30) ["s"]=> int(12) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(285) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for hhvm-3.15.4
object(DateInterval)#3 (0) { }