3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $date_from = date('Y-m-d'); $date_to = date('Y-m-d'); $periods = new DatePeriod( new DateTime($date_from), new DateInterval('P1D'), new DateTime($date_to) ); var_dump($periods);
Output for 7.1.0 - 7.2.0
object(DatePeriod)#1 (6) { ["start"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["current"]=> NULL ["end"]=> object(DateTime)#3 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["interval"]=> object(DateInterval)#4 (16) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["f"]=> float(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> bool(false) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) } ["recurrences"]=> int(1) ["include_start_date"]=> bool(true) }
Output for 5.5.14 - 7.0.20
object(DatePeriod)#1 (6) { ["start"]=> object(DateTime)#2 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["current"]=> NULL ["end"]=> object(DateTime)#3 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["interval"]=> object(DateInterval)#4 (15) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> bool(false) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) } ["recurrences"]=> int(1) ["include_start_date"]=> bool(true) }
Output for 5.5.0 - 5.5.13
object(DatePeriod)#1 (6) { ["start"]=> object(DateTime)#2 (3) { ["date"]=> string(19) "2015-12-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["current"]=> NULL ["end"]=> object(DateTime)#3 (3) { ["date"]=> string(19) "2015-12-02 00:00:00" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["interval"]=> object(DateInterval)#4 (15) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["weekday"]=> int(0) ["weekday_behavior"]=> int(0) ["first_last_day_of"]=> int(0) ["invert"]=> int(0) ["days"]=> bool(false) ["special_type"]=> int(0) ["special_amount"]=> int(0) ["have_weekday_relative"]=> int(0) ["have_special_relative"]=> int(0) } ["recurrences"]=> int(1) ["include_start_date"]=> bool(true) }