3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $m = 1; $y = 2016; echo "Original date Resulting date\n\n"; foreach (range(1, 31) as $day) { if($day <= 9){ $day = '0'.$day; } // this is the important bit $snap = strtotime("monday this week",strtotime("$m/$day/$y")); echo str_pad(date('l',strtotime("$m/$day/$y")), 9, " ", STR_PAD_LEFT)," $m/$day/$y: ",date('r',$snap),"\n"; }
based on TdT4i

Shows result from various feature-branches currently under review from the php developers. Contact me to have additional branches featured.

Output for Array change keys
Original date Resulting date Friday 1/01/2016: Mon, 28 Dec 2015 00:00:00 +0100 Saturday 1/02/2016: Mon, 28 Dec 2015 00:00:00 +0100 Sunday 1/03/2016: Mon, 28 Dec 2015 00:00:00 +0100 Monday 1/04/2016: Mon, 04 Jan 2016 00:00:00 +0100 Tuesday 1/05/2016: Mon, 04 Jan 2016 00:00:00 +0100 Wednesday 1/06/2016: Mon, 04 Jan 2016 00:00:00 +0100 Thursday 1/07/2016: Mon, 04 Jan 2016 00:00:00 +0100 Friday 1/08/2016: Mon, 04 Jan 2016 00:00:00 +0100 Saturday 1/09/2016: Mon, 04 Jan 2016 00:00:00 +0100 Sunday 1/10/2016: Mon, 04 Jan 2016 00:00:00 +0100 Monday 1/11/2016: Mon, 11 Jan 2016 00:00:00 +0100 Tuesday 1/12/2016: Mon, 11 Jan 2016 00:00:00 +0100 Wednesday 1/13/2016: Mon, 11 Jan 2016 00:00:00 +0100 Thursday 1/14/2016: Mon, 11 Jan 2016 00:00:00 +0100 Friday 1/15/2016: Mon, 11 Jan 2016 00:00:00 +0100 Saturday 1/16/2016: Mon, 11 Jan 2016 00:00:00 +0100 Sunday 1/17/2016: Mon, 11 Jan 2016 00:00:00 +0100 Monday 1/18/2016: Mon, 18 Jan 2016 00:00:00 +0100 Tuesday 1/19/2016: Mon, 18 Jan 2016 00:00:00 +0100 Wednesday 1/20/2016: Mon, 18 Jan 2016 00:00:00 +0100 Thursday 1/21/2016: Mon, 18 Jan 2016 00:00:00 +0100 Friday 1/22/2016: Mon, 18 Jan 2016 00:00:00 +0100 Saturday 1/23/2016: Mon, 18 Jan 2016 00:00:00 +0100 Sunday 1/24/2016: Mon, 18 Jan 2016 00:00:00 +0100 Monday 1/25/2016: Mon, 25 Jan 2016 00:00:00 +0100 Tuesday 1/26/2016: Mon, 25 Jan 2016 00:00:00 +0100 Wednesday 1/27/2016: Mon, 25 Jan 2016 00:00:00 +0100 Thursday 1/28/2016: Mon, 25 Jan 2016 00:00:00 +0100 Friday 1/29/2016: Mon, 25 Jan 2016 00:00:00 +0100 Saturday 1/30/2016: Mon, 25 Jan 2016 00:00:00 +0100 Sunday 1/31/2016: Mon, 25 Jan 2016 00:00:00 +0100
Output for Lexical anon
Original date Resulting date Friday 1/01/2016: Mon, 28 Dec 2015 00:00:00 +0100 Saturday 1/02/2016: Mon, 28 Dec 2015 00:00:00 +0100 Sunday 1/03/2016: Mon, 04 Jan 2016 00:00:00 +0100 Monday 1/04/2016: Mon, 04 Jan 2016 00:00:00 +0100 Tuesday 1/05/2016: Mon, 04 Jan 2016 00:00:00 +0100 Wednesday 1/06/2016: Mon, 04 Jan 2016 00:00:00 +0100 Thursday 1/07/2016: Mon, 04 Jan 2016 00:00:00 +0100 Friday 1/08/2016: Mon, 04 Jan 2016 00:00:00 +0100 Saturday 1/09/2016: Mon, 04 Jan 2016 00:00:00 +0100 Sunday 1/10/2016: Mon, 11 Jan 2016 00:00:00 +0100 Monday 1/11/2016: Mon, 11 Jan 2016 00:00:00 +0100 Tuesday 1/12/2016: Mon, 11 Jan 2016 00:00:00 +0100 Wednesday 1/13/2016: Mon, 11 Jan 2016 00:00:00 +0100 Thursday 1/14/2016: Mon, 11 Jan 2016 00:00:00 +0100 Friday 1/15/2016: Mon, 11 Jan 2016 00:00:00 +0100 Saturday 1/16/2016: Mon, 11 Jan 2016 00:00:00 +0100 Sunday 1/17/2016: Mon, 18 Jan 2016 00:00:00 +0100 Monday 1/18/2016: Mon, 18 Jan 2016 00:00:00 +0100 Tuesday 1/19/2016: Mon, 18 Jan 2016 00:00:00 +0100 Wednesday 1/20/2016: Mon, 18 Jan 2016 00:00:00 +0100 Thursday 1/21/2016: Mon, 18 Jan 2016 00:00:00 +0100 Friday 1/22/2016: Mon, 18 Jan 2016 00:00:00 +0100 Saturday 1/23/2016: Mon, 18 Jan 2016 00:00:00 +0100 Sunday 1/24/2016: Mon, 25 Jan 2016 00:00:00 +0100 Monday 1/25/2016: Mon, 25 Jan 2016 00:00:00 +0100 Tuesday 1/26/2016: Mon, 25 Jan 2016 00:00:00 +0100 Wednesday 1/27/2016: Mon, 25 Jan 2016 00:00:00 +0100 Thursday 1/28/2016: Mon, 25 Jan 2016 00:00:00 +0100 Friday 1/29/2016: Mon, 25 Jan 2016 00:00:00 +0100 Saturday 1/30/2016: Mon, 25 Jan 2016 00:00:00 +0100 Sunday 1/31/2016: Mon, 01 Feb 2016 00:00:00 +0100
Output for Typed properties
Original date Resulting date Friday 1/01/2016: Mon, 28 Dec 2015 00:00:00 +0100 Saturday 1/02/2016: Mon, 28 Dec 2015 00:00:00 +0100 Sunday 1/03/2016: Mon, 28 Dec 2015 00:00:00 +0100 Monday 1/04/2016: Mon, 04 Jan 2016 00:00:00 +0100 Tuesday 1/05/2016: Mon, 04 Jan 2016 00:00:00 +0100 Wednesday 1/06/2016: Mon, 04 Jan 2016 00:00:00 +0100 Thursday 1/07/2016: Mon, 04 Jan 2016 00:00:00 +0100 Friday 1/08/2016: Mon, 04 Jan 2016 00:00:00 +0100 Saturday 1/09/2016: Mon, 04 Jan 2016 00:00:00 +0100 Sunday 1/10/2016: Mon, 04 Jan 2016 00:00:00 +0100 Monday 1/11/2016: Mon, 11 Jan 2016 00:00:00 +0100 Tuesday 1/12/2016: Mon, 11 Jan 2016 00:00:00 +0100 Wednesday 1/13/2016: Mon, 11 Jan 2016 00:00:00 +0100 Thursday 1/14/2016: Mon, 11 Jan 2016 00:00:00 +0100 Friday 1/15/2016: Mon, 11 Jan 2016 00:00:00 +0100 Saturday 1/16/2016: Mon, 11 Jan 2016 00:00:00 +0100 Sunday 1/17/2016: Mon, 11 Jan 2016 00:00:00 +0100 Monday 1/18/2016: Mon, 18 Jan 2016 00:00:00 +0100 Tuesday 1/19/2016: Mon, 18 Jan 2016 00:00:00 +0100 Wednesday 1/20/2016: Mon, 18 Jan 2016 00:00:00 +0100 Thursday 1/21/2016: Mon, 18 Jan 2016 00:00:00 +0100 Friday 1/22/2016: Mon, 18 Jan 2016 00:00:00 +0100 Saturday 1/23/2016: Mon, 18 Jan 2016 00:00:00 +0100 Sunday 1/24/2016: Mon, 18 Jan 2016 00:00:00 +0100 Monday 1/25/2016: Mon, 25 Jan 2016 00:00:00 +0100 Tuesday 1/26/2016: Mon, 25 Jan 2016 00:00:00 +0100 Wednesday 1/27/2016: Mon, 25 Jan 2016 00:00:00 +0100 Thursday 1/28/2016: Mon, 25 Jan 2016 00:00:00 +0100 Friday 1/29/2016: Mon, 25 Jan 2016 00:00:00 +0100 Saturday 1/30/2016: Mon, 25 Jan 2016 00:00:00 +0100 Sunday 1/31/2016: Mon, 25 Jan 2016 00:00:00 +0100

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