3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $interval = new DateInterval('P1D'); // 1Day Interval $daterange = new DatePeriod($time['start'], $interval , 2); $return['days'] = array(); foreach($daterange as $date){ $return['days'][] = $date->format("Y-m-d"); }
Output for 7.0.0 - 7.1.0
Notice: Undefined variable: time in /in/hkhe1 on line 3 Fatal error: Uncaught Exception: DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments. in /in/hkhe1:3 Stack trace: #0 /in/hkhe1(3): DatePeriod->__construct(NULL, Object(DateInterval), 2) #1 {main} thrown in /in/hkhe1 on line 3
Process exited with code 255.
Output for 5.5.0 - 5.6.28
Notice: Undefined variable: time in /in/hkhe1 on line 3 Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTimeInterface, DateInterval, int) OR (DateTimeInterface, DateInterval, DateTime) OR (string) as arguments.' in /in/hkhe1:3 Stack trace: #0 /in/hkhe1(3): DatePeriod->__construct(NULL, Object(DateInterval), 2) #1 {main} thrown in /in/hkhe1 on line 3
Process exited with code 255.
Output for 5.3.0 - 5.4.45
Notice: Undefined variable: time in /in/hkhe1 on line 3 Fatal error: Uncaught exception 'Exception' with message 'DatePeriod::__construct(): This constructor accepts either (DateTime, DateInterval, int) OR (DateTime, DateInterval, DateTime) OR (string) as arguments.' in /in/hkhe1:3 Stack trace: #0 /in/hkhe1(3): DatePeriod->__construct(NULL, Object(DateInterval), 2) #1 {main} thrown in /in/hkhe1 on line 3
Process exited with code 255.
Output for 5.0.0 - 5.2.17
Fatal error: Class 'DateInterval' not found in /in/hkhe1 on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: dateinterval in /in/hkhe1 on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: dateinterval in /in/hkhe1 on line 2