3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDaysInWeek ($weekNumber, $year) { // Count from '0104' because January 4th is always in week 1 // (according to ISO 8601). $time = strtotime($year . '0104 +' . ($weekNumber - 1) . ' weeks'); // Get the time of the first day of the week $mondayTime = strtotime('-' . (date('w', $time) + 1) . ' days', $time); // Get the times of days 0 -> 6 $dayTimes = array (); for ($i = 0; $i < 5; ++$i) { $dayTimes[] = strtotime('+' . $i . ' days', $mondayTime); } // Return timestamps for mon-sun. return $dayTimes; } echo "working days in the 53th week from 2015". "<br>"; setlocale(LC_ALL, 'nl_NL'); $werkdagen = getDaysInWeek("53", "2015"); echo (strftime('%d-%m-%Y', $werkdagen[0])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[1])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[2])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[3])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[4])) . "<br>"; echo "<br>"; echo "working days in the 1st week from 2016". "<br>"; $werkdagen = getDaysInWeek("1", "2016"); echo (strftime('%d-%m-%Y', $werkdagen[0])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[1])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[2])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[3])) . "<br>"; echo (strftime('%d-%m-%Y', $werkdagen[4])) . "<br>"; echo "<br>"; ?>
Output for git.master, git.master_jit, rfc.property-hooks
working days in the 53th week from 2015<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 21 02-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 22 03-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 23 04-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 24 05-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 25 06-01-2016<br><br>working days in the 1st week from 2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 29 02-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 30 03-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 31 04-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 32 05-01-2016<br> Deprecated: Function strftime() is deprecated in /in/QTvgN on line 33 06-01-2016<br><br>

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:
38.51 ms | 403 KiB | 8 Q