3v4l.org

run code in 300+ PHP versions simultaneously
<?php $firstAvailableCount = 100; $slice = 'weekly'; $countData = array(); $startDateTime = new DateTime("2016-01-10"); $endDateTime = new DateTime("2016-01-12"); fillCountMapPeriod($startDateTime,$endDateTime,$countData,$firstAvailableCount,$slice); function fillCountMapPeriod( DateTime $startDateTime, DateTime $endDateTime, array $countData, $firstAvailableCount, $slice) { if($slice == 'monthly') { $interval = new DateInterval('P1M'); $format = 'm-Y'; $startDateTime = DateTime::createFromFormat($format."-d",$startDateTime->format($format).-"1"); $endDateTime = DateTime::createFromFormat($format."-d",$endDateTime->format($format).-"1"); } else { $interval = new DateInterval('P1W'); $format = 'W-Y'; $startDateTime = DateTime::createFromFormat($format,$startDateTime->format($format)); $endDateTime = DateTime::createFromFormat($format,$endDateTime->format($format)); var_dump($startDateTime); var_dump($endDateTime); } if($startDateTime->format($format) == $endDateTime->format($format)) { var_dump($startDateTime->format($format)); return; } //var_dump($endDateTime); while($startDateTime <= $endDateTime){ var_dump($startDateTime->format("d-".$format)); $startDateTime->add($interval); } }
Output for git.master, git.master_jit
bool(false) bool(false) Fatal error: Uncaught Error: Call to a member function format() on bool in /in/h06uQ:28 Stack trace: #0 /in/h06uQ(10): fillCountMapPeriod(false, false, Array, 100, 'weekly') #1 {main} thrown in /in/h06uQ on line 28
Process exited with code 255.
Output for rfc.property-hooks
bool(false) bool(false) Fatal error: Uncaught Error: Call to a member function format() on false in /in/h06uQ:28 Stack trace: #0 /in/h06uQ(10): fillCountMapPeriod(false, false, Array, 100, 'weekly') #1 {main} thrown in /in/h06uQ on line 28
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:
81.43 ms | 401 KiB | 8 Q