3v4l.org

run code in 500+ PHP versions simultaneously
<?php $tests = [ '2016-01','2016-02','2016-03','2016-04','2016-05','2016-06','2016-07','2016-08','2016-09','2016-10','2016-11','2016-12', '2018-01','2018-02','2018-03','2018-04','2018-05','2018-06','2018-07','2018-08','2018-09','2018-10','2018-11','2018-12', ]; foreach($tests as $test) { $start = new DateTime($test); $end = intval((clone $start)->modify('last day of this month')->format('W')); if($end < 2) $end = intval((clone $start)->modify('last sunday of this month')->format('W')) + 1; $start = intval($start->format('W')); if($start > 51) $start = 0;$weeks = $end - $start + 1; echo "$test = $weeks\n"; }
Output for git.master, git.master_jit, rfc.property-hooks
2016-01 = 5 2016-02 = 5 2016-03 = 5 2016-04 = 5 2016-05 = 6 2016-06 = 5 2016-07 = 5 2016-08 = 5 2016-09 = 5 2016-10 = 6 2016-11 = 5 2016-12 = 5 2018-01 = 5 2018-02 = 5 2018-03 = 5 2018-04 = 6 2018-05 = 5 2018-06 = 5 2018-07 = 6 2018-08 = 5 2018-09 = 5 2018-10 = 5 2018-11 = 5 2018-12 = 6

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:
52.08 ms | 2046 KiB | 4 Q