3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $start_date = '2014-3-19'; $end_date = '2014-5-19'; $begin = new DateTime( $start_date ); $end = new DateTime(date("Y-m-d",strtotime("+1 day", strtotime($end_date)))); while($begin < $end) { $period[] = $begin->format('Y-m-d'); $begin->modify('+1 day'); } print_r($period);
Output for 5.2.2 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Array ( [0] => 2014-03-19 [1] => 2014-03-20 [2] => 2014-03-21 [3] => 2014-03-22 [4] => 2014-03-23 [5] => 2014-03-24 [6] => 2014-03-25 [7] => 2014-03-26 [8] => 2014-03-27 [9] => 2014-03-28 [10] => 2014-03-29 [11] => 2014-03-30 [12] => 2014-03-31 [13] => 2014-04-01 [14] => 2014-04-02 [15] => 2014-04-03 [16] => 2014-04-04 [17] => 2014-04-05 [18] => 2014-04-06 [19] => 2014-04-07 [20] => 2014-04-08 [21] => 2014-04-09 [22] => 2014-04-10 [23] => 2014-04-11 [24] => 2014-04-12 [25] => 2014-04-13 [26] => 2014-04-14 [27] => 2014-04-15 [28] => 2014-04-16 [29] => 2014-04-17 [30] => 2014-04-18 [31] => 2014-04-19 [32] => 2014-04-20 [33] => 2014-04-21 [34] => 2014-04-22 [35] => 2014-04-23 [36] => 2014-04-24 [37] => 2014-04-25 [38] => 2014-04-26 [39] => 2014-04-27 [40] => 2014-04-28 [41] => 2014-04-29 [42] => 2014-04-30 [43] => 2014-05-01 [44] => 2014-05-02 [45] => 2014-05-03 [46] => 2014-05-04 [47] => 2014-05-05 [48] => 2014-05-06 [49] => 2014-05-07 [50] => 2014-05-08 [51] => 2014-05-09 [52] => 2014-05-10 [53] => 2014-05-11 [54] => 2014-05-12 [55] => 2014-05-13 [56] => 2014-05-14 [57] => 2014-05-15 [58] => 2014-05-16 [59] => 2014-05-17 [60] => 2014-05-18 [61] => 2014-05-19 )
Output for 5.2.0 - 5.2.1
Notice: Undefined variable: period in /in/3XCeW on line 13
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/3XCeW on line 6
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/3XCeW on line 6
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/3XCeW on line 6