3v4l.org

run code in 300+ PHP versions simultaneously
<?php $dateRange = '2014-01-01 - 2014-01-08'; $parts = explode(' - ', $dateRange); $begin = new \DateTime($parts[0]); $end = new \DateTime($parts[1]); $interval = new \DateInterval('P1D'); $datePeriod = new \DatePeriod($begin, $interval, $end, DatePeriod::EXCLUDE_START_DATE); $periodArray = iterator_to_array($datePeriod); $startDate = reset($periodArray); $endDate = end($periodArray); #echo $datePeriod->start->format('c'); #echo "\n"; echo $startDate->format('c'); echo "\n"; #echo "\n"; #echo $datePeriod->end->format('c'); #echo "\n"; echo $endDate->format('c'); echo "\n"; echo "\n"; echo print_r($periodArray);)
Output for 5.3.0 - 5.3.28, 5.4.0 - 5.4.24
Parse error: syntax error, unexpected ')' in /in/hrL16 on line 23
Process exited with code 255.

preferences:
171.22 ms | 1399 KiB | 61 Q