3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $now = new DateTime; $then = new DateTime('24 Aug 2006'); $diff = $now->diff($then); var_dump($diff);
Output for 7.2.12
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(7.9E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.11
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.4E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.0, 7.2.10
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000113) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.9
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000142) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.8
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000101) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.7
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00017) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.6
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000109) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.24, 7.2.1, 7.2.5
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(8.9E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.4
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000126) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.3
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.6E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.2
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.7E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.23
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00013) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.17, 7.1.22
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.0E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.8, 7.1.21
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00011) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.20
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000103) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.19
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000161) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.18
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000102) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.16
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(8.6E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.15
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000115) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.14
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000104) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.13
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00015) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.12
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000195) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.11
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000127) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["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(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000124) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.1, 7.1.9
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00012) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["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(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.000111) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["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(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.9E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["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(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0.00014) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.4
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(8.4E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.3
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.2
object(DateInterval)#3 (16) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(7.6E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["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(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["f"]=> float(9.5E-5) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.3.27 - 5.3.29, 5.4.17 - 5.6.38, 7.0.0 - 7.0.32
object(DateInterval)#3 (15) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(1) ["days"]=> int(2648) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for hhvm-3.10.1 - 3.22.0
object(DateInterval)#3 (0) { }
Output for 5.3.0 - 5.3.26, 5.4.0 - 5.4.16
object(DateInterval)#3 (8) { ["y"]=> int(7) ["m"]=> int(2) ["d"]=> int(30) ["h"]=> int(1) ["i"]=> int(42) ["s"]=> int(50) ["invert"]=> int(1) ["days"]=> int(2648) }
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::diff() in /in/TCfg3 on line 5
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/TCfg3 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/TCfg3 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/TCfg3 on line 3