3v4l.org

run code in 300+ PHP versions simultaneously
<?php $month=9; $year=2014; // Mantech $startDate = strtotime($month.'/1/'.$year); $stopDate = strtotime('last day of this month ',$startDate); if (date('D',$startDate)!='Sat'){ $startDate = strtotime('next saturday',$startDate); } if (date('D',$stopDate)!='Fri'){ $stopDate = strtotime('next friday',$stopDate); } echo (date('Y-m-d',$startDate).' - '.date('Y-m-d',$stopDate)."\n"); // If our startDate isn't a Monday, grab the previous Monday if (date('D',$startDate)!='Mon'){ $prevMonday = strtotime('last Monday',$startDate); } else { $prevMonday = $startDate; } // Format startweek as ISO8601 eg.2014W15 echo (date('Y-m-d',$prevMonday)."\n"); $beginWeek = date('o',$prevMonday).'W'.date('W',$prevMonday); echo ($beginWeek."\n"); echo (date('Y-m-d',strtotime($beginWeek))."\n"); $datediff=$stopDate-$startDate; $weeks=ceil($datediff/(60*60*24*7)); echo ($weeks."\n"); for ($i=0; $i<=$weeks; $i++){ $thisWeek = strtotime($beginWeek.' +'.$i.' weeks'); echo (date('Y-m-d',$thisWeek)."\n"); $mask = ''; for ($j=0; $j<7; $j++){ $thisDay = strtotime('+'.$j.' days',$thisWeek); echo (date('Y-m-d',$thisDay)."\n"); if ($startDate<=$thisDay and $thisDay<=$stopDate){ $mask=$mask.'1'; } else { $mask=$mask.'0'; } } echo $mask."\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
2014-09-06 - 2014-10-03 2014-09-01 2014W36 2014-09-01 4 2014-09-01 2014-09-01 2014-09-02 2014-09-03 2014-09-04 2014-09-05 2014-09-06 2014-09-07 0000011 2014-09-08 2014-09-08 2014-09-09 2014-09-10 2014-09-11 2014-09-12 2014-09-13 2014-09-14 1111111 2014-09-15 2014-09-15 2014-09-16 2014-09-17 2014-09-18 2014-09-19 2014-09-20 2014-09-21 1111111 2014-09-22 2014-09-22 2014-09-23 2014-09-24 2014-09-25 2014-09-26 2014-09-27 2014-09-28 1111111 2014-09-29 2014-09-29 2014-09-30 2014-10-01 2014-10-02 2014-10-03 2014-10-04 2014-10-05 1111100

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