3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php var_dump( date_diff(date_create_from_format('Y-m-d H:i:s', '2015-11-10 12:30:00'), date_create('now'))->format('d') ); var_dump(date_create()); var_dump(date_create_from_format('Y-m-d H:i:s', '2015-11-10 12:30:00')); var_dump(date_diff(date_create_from_format('Y-m-d H:i:s', '2015-11-10 12:30:00'), date_create('now')));
based on c2gbO
Output for 7.2.0
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.003888" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.003947) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.10
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.003578" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.003627) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.7
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.003997" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.004037) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.6
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.013656" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.013764) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.5
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.010158" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.010251) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 7.1.0
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.004030" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["f"]=> float(0.004112) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.5.14 - 7.0.20
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-11 13:45:16.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(26) "2015-11-10 12:30:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (15) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }
Output for 5.5.0 - 5.5.13
string(1) "d" object(DateTime)#3 (3) { ["date"]=> string(19) "2015-11-11 13:45:16" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateTime)#3 (3) { ["date"]=> string(19) "2015-11-10 12:30:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } object(DateInterval)#2 (15) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(1) ["i"]=> int(15) ["s"]=> int(16) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> int(1) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) }