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('M1D'); $datePeriod = new \DatePeriod($begin, $interval, $end); $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 git.master, git.master_jit
Fatal error: Uncaught Exception: Unknown or bad format (M1D) in /in/aBCB2:6 Stack trace: #0 /in/aBCB2(6): DateInterval->__construct('M1D') #1 {main} thrown in /in/aBCB2 on line 6
Process exited with code 255.
Output for rfc.property-hooks
Fatal error: Uncaught DateMalformedIntervalStringException: Unknown or bad format (M1D) in /in/aBCB2:6 Stack trace: #0 /in/aBCB2(6): DateInterval->__construct('M1D') #1 {main} thrown in /in/aBCB2 on line 6
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
40.81 ms | 401 KiB | 8 Q