3v4l.org

run code in 300+ PHP versions simultaneously
<?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 8.2.0 - 8.2.17, 8.3.0 - 8.3.4
object(DatePeriod)#1 (7) { ["start"]=> object(DateTime)#5 (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)#6 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } ["interval"]=> object(DateInterval)#7 (10) { ["y"]=> int(0) ["m"]=> int(0) ["d"]=> int(1) ["h"]=> int(0) ["i"]=> int(0) ["s"]=> int(0) ["f"]=> float(0) ["invert"]=> int(0) ["days"]=> bool(false) ["from_string"]=> bool(false) } ["recurrences"]=> int(1) ["include_start_date"]=> bool(true) ["include_end_date"]=> bool(false) }
Output for 7.3.16 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.27
object(DatePeriod)#1 (6) { ["start"]=> object(DateTime)#4 (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)#2 (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 7.3.32 - 7.3.33, 8.0.13
object(DatePeriod)#1 (6) { ["start"]=> object(DateTime)#4 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } ["current"]=> NULL ["end"]=> object(DateTime)#3 (3) { ["date"]=> string(26) "2015-12-02 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(3) "UTC" } ["interval"]=> object(DateInterval)#2 (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 7.1.0 - 7.1.20, 7.2.0 - 7.2.33
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 - 5.5.38, 5.6.0 - 5.6.28, 7.0.0 - 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) }

preferences:
186.53 ms | 403 KiB | 221 Q