3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php date_default_timezone_set('Europe/Berlin'); $birthday = new DateTime('1990-09-23 22:09'); $today = new DateTime(); if (date('I') == 0) $today->add(new DateInterval('PT1H')); $age = $birthday->diff($today, true); var_dump($age);
Output for 7.3.1
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.026575) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.3.0
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.000225) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.13
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.000168) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.12
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.013771) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.018555) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.10
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.009606) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.019255) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.080419) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.033587) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.011296) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.5
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.036159) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.076126) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.063782) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.050517) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.1
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.00013) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.2.0
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.000125) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.25
object(DateInterval)#3 (16) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.000154) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.003545) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.002845) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.002883) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.013248) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.011854) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["f"]=> float(0.005983) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["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 - 7.0.20
object(DateInterval)#3 (15) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(8524) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.3.0 - 5.3.26, 5.4.0 - 5.4.16
object(DateInterval)#3 (8) { ["y"]=> int(23) ["m"]=> int(4) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(6) ["s"]=> int(36) ["invert"]=> int(0) ["days"]=> int(8524) }
Output for 5.2.0 - 5.2.17
Fatal error: Call to undefined method DateTime::add() in /in/LNquE on line 7
Process exited with code 255.
Output for 5.1.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/LNquE on line 3
Process exited with code 255.
Output for 5.0.0 - 5.0.5
Fatal error: Call to undefined function date_default_timezone_set() in /in/LNquE on line 2
Process exited with code 255.
Output for 4.4.5 - 4.4.9
Fatal error: Call to undefined function: date_default_timezone_set() in /in/LNquE on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.4
Fatal error: Call to undefined function: date_default_timezone_set() in /in/LNquE on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Call to undefined function: date_default_timezone_set() in /in/LNquE on line 2