3v4l.org

run code in 300+ PHP versions simultaneously
<?php function countDaysForChoosenYears(int $year):int { $att = []; for ($i = 1; $i <= 12; $i++) { $att[] = cal_days_in_month(CAL_GREGORIAN, $i, $year); } $att = array_sum($att); return $att; } $YearMonthDayStructure = []; $Date = new DateTime('2016-01-01'); for ($i = 1; $i <= countDaysForChoosenYears(2016); $i++) { $monthName = $Date->format('F'); $yearNumber = $Date->format('Y'); $YearMonthDayStructure[$yearNumber][$monthName][$Date->format('d')] = $Date->format('Y-m-d'); $Date->add(new DateInterval('P1D')); } print_r($YearMonthDayStructure);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught Error: Call to undefined function cal_days_in_month() in /in/p2518:6 Stack trace: #0 /in/p2518(17): countDaysForChoosenYears(2016) #1 {main} thrown in /in/p2518 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:
72.06 ms | 405 KiB | 5 Q