3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $begin = '2014-3-19'; $end = '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'); } var_dump($period);
Output for 5.2.0 - 5.6.28, hhvm-3.10.0, 7.0.0 - 7.1.0
Notice: Undefined variable: start_date in /in/Ya3pu on line 6 Notice: Undefined variable: end_date in /in/Ya3pu on line 7 Notice: Undefined variable: period in /in/Ya3pu on line 13 NULL
Output for hhvm-3.12.0 - 3.13.2
Notice: Undefined variable: start_date in /in/Ya3pu on line 6 Fatal error: Uncaught exception 'Exception' with message '__construct() expects parameter 1 to be string, null given' in /in/Ya3pu:6 Stack trace: #0 /in/Ya3pu(6): DateTime->__construct() #1 {main}
Process exited with code 255.
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/Ya3pu 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/Ya3pu 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/Ya3pu on line 6