3v4l.org

run code in 300+ PHP versions simultaneously
<?php /** * Boilerplate to setup variables */ $start = new DateTime('2013-01-01'); $end = new DateTime('2013-12-31'); $interval = new DateInterval('P1D'); $period = new DatePeriod($start, $interval, $end->add($interval)); foreach($period as $date){ $dateArray[] = $date->format('Y-m-d'); } /** * End of boilerplate */ /** * Answer code */ $countArray = array('Jan' => 0, 'Feb' => 0, 'Mar' => 0, 'Apr' => 0, 'May' => 0, 'Jun' => 0, 'Jul' => 0, 'Aug' => 0, 'Sep' => 0, 'Oct' => 0, 'Nov' => 0, 'Dec' => 0); foreach($dateArray as $dateString){ $date = new DateTime($dateString); $countArray[$date->format('M')]++; } var_dump($countArray);
Output for git.master, git.master_jit, rfc.property-hooks
array(12) { ["Jan"]=> int(31) ["Feb"]=> int(28) ["Mar"]=> int(31) ["Apr"]=> int(30) ["May"]=> int(31) ["Jun"]=> int(30) ["Jul"]=> int(31) ["Aug"]=> int(31) ["Sep"]=> int(30) ["Oct"]=> int(31) ["Nov"]=> int(30) ["Dec"]=> int(31) }

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:
31.98 ms | 402 KiB | 8 Q