3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $dateB = new DateTime('2010-12-01 0:0:0'); $now = new DateTime; var_dump($now->diff($dateB));
based on K93ZG
Output for 7.2.0
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.00395) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.10
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.003771) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.7
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.003185) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.6
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.01251) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.5
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.007308) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.0
object(DateInterval)#3 (16) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["f"]=> float(0.004081) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.5.0 - 7.0.20
object(DateInterval)#3 (15) { ["y"]=> int(5) ["m"]=> int(1) ["d"]=> int(15) ["h"]=> int(21) ["i"]=> int(29) ["s"]=> int(18) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(1872) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }