3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $dt = new DateTime(); $test = clone $dt; $test->modify('first day'); var_dump($test->format('r')); $test = clone $dt; $test->modify('first day of'); var_dump($test->format('r'));
based on YNsC8
Output for 5.6.28, 7.0.14 - 7.1.0
string(31) "Wed, 06 Aug 2014 13:04:05 +0200" string(31) "Fri, 01 Aug 2014 13:04:05 +0200"
Output for 7.0.6
string(31) "Wed, 04 May 2016 09:41:27 +0200" string(31) "Sun, 01 May 2016 09:41:27 +0200"
Output for 7.0.5
string(31) "Sun, 03 Apr 2016 22:33:42 +0200" string(31) "Fri, 01 Apr 2016 22:33:42 +0200"
Output for 7.0.4
string(31) "Fri, 11 Mar 2016 09:06:04 +0100" string(31) "Tue, 01 Mar 2016 09:06:04 +0100"
Output for 7.0.3
string(31) "Sat, 19 Mar 2016 09:43:03 +0100" string(31) "Tue, 01 Mar 2016 09:43:03 +0100"
Output for 7.0.2
string(31) "Wed, 23 Mar 2016 15:36:54 +0100" string(31) "Tue, 01 Mar 2016 15:36:54 +0100"
Output for 7.0.1
string(31) "Thu, 24 Mar 2016 20:22:18 +0100" string(31) "Tue, 01 Mar 2016 20:22:18 +0100"
Output for 7.0.0
string(31) "Sun, 27 Mar 2016 21:54:55 +0200" string(31) "Tue, 01 Mar 2016 21:54:55 +0100"
Output for 5.6.21
string(31) "Tue, 03 May 2016 05:03:11 +0200" string(31) "Sun, 01 May 2016 05:03:11 +0200"
Output for 5.6.20
string(31) "Sun, 10 Apr 2016 21:30:30 +0200" string(31) "Fri, 01 Apr 2016 21:30:30 +0200"
Output for 5.6.19
string(31) "Tue, 08 Mar 2016 17:14:08 +0100" string(31) "Tue, 01 Mar 2016 17:14:08 +0100"
Output for 5.6.18
string(31) "Wed, 16 Mar 2016 01:08:14 +0100" string(31) "Tue, 01 Mar 2016 01:08:14 +0100"
Output for 5.6.17
string(31) "Sun, 20 Mar 2016 13:58:41 +0100" string(31) "Tue, 01 Mar 2016 13:58:41 +0100"
Output for 5.6.16
string(31) "Mon, 28 Mar 2016 23:40:20 +0200" string(31) "Tue, 01 Mar 2016 23:40:20 +0100"
Output for 5.6.15
string(31) "Wed, 30 Mar 2016 00:45:32 +0200" string(31) "Tue, 01 Mar 2016 00:45:32 +0100"
Output for 5.6.14
string(31) "Sun, 03 Apr 2016 03:06:25 +0200" string(31) "Fri, 01 Apr 2016 03:06:25 +0200"
Output for 5.6.13
string(31) "Sat, 16 Apr 2016 07:00:35 +0200" string(31) "Fri, 01 Apr 2016 07:00:35 +0200"
Output for 5.6.12
string(31) "Wed, 20 Apr 2016 20:45:14 +0200" string(31) "Fri, 01 Apr 2016 20:45:14 +0200"
Output for 5.6.11
string(31) "Sun, 24 Apr 2016 03:49:05 +0200" string(31) "Fri, 01 Apr 2016 03:49:05 +0200"
Output for 5.6.10
string(31) "Tue, 26 Apr 2016 05:32:48 +0200" string(31) "Fri, 01 Apr 2016 05:32:48 +0200"
Output for 5.6.9
string(31) "Thu, 28 Apr 2016 10:30:54 +0200" string(31) "Fri, 01 Apr 2016 10:30:54 +0200"
Output for 5.6.8
string(31) "Sat, 30 Apr 2016 18:35:46 +0200" string(31) "Fri, 01 Apr 2016 18:35:46 +0200"
Output for 5.5.35
string(31) "Mon, 23 May 2016 08:46:33 +0200" string(31) "Sun, 01 May 2016 08:46:33 +0200"
Output for 5.5.34
string(31) "Mon, 11 Apr 2016 23:50:49 +0200" string(31) "Fri, 01 Apr 2016 23:50:49 +0200"
Output for 5.5.33
string(31) "Wed, 09 Mar 2016 20:11:06 +0100" string(31) "Tue, 01 Mar 2016 20:11:06 +0100"
Output for 5.5.32
string(31) "Fri, 18 Mar 2016 02:51:25 +0100" string(31) "Tue, 01 Mar 2016 02:51:25 +0100"
Output for 5.5.31
string(31) "Mon, 21 Mar 2016 16:44:30 +0100" string(31) "Tue, 01 Mar 2016 16:44:30 +0100"
Output for 5.5.30
string(31) "Sat, 02 Apr 2016 02:41:08 +0200" string(31) "Fri, 01 Apr 2016 02:41:08 +0200"
Output for 5.5.29
string(31) "Sun, 17 Apr 2016 21:06:10 +0200" string(31) "Fri, 01 Apr 2016 21:06:10 +0200"
Output for 5.5.28
string(31) "Thu, 21 Apr 2016 23:50:26 +0200" string(31) "Fri, 01 Apr 2016 23:50:26 +0200"
Output for 5.5.27
string(31) "Sat, 23 Apr 2016 02:20:04 +0200" string(31) "Fri, 01 Apr 2016 02:20:04 +0200"
Output for 5.5.26
string(31) "Wed, 27 Apr 2016 07:59:40 +0200" string(31) "Fri, 01 Apr 2016 07:59:40 +0200"
Output for 5.5.25
string(31) "Fri, 29 Apr 2016 14:17:45 +0200" string(31) "Fri, 01 Apr 2016 14:17:45 +0200"
Output for 5.5.24
string(31) "Tue, 24 May 2016 21:38:48 +0200" string(31) "Sun, 01 May 2016 21:38:48 +0200"
Output for 5.4.45
string(31) "Tue, 22 Sep 2015 12:05:53 +0200" string(31) "Tue, 01 Sep 2015 12:05:53 +0200"
Output for 5.4.44
string(31) "Tue, 22 Sep 2015 12:05:48 +0200" string(31) "Tue, 01 Sep 2015 12:05:48 +0200"
Output for 5.4.43
string(31) "Tue, 22 Sep 2015 12:05:42 +0200" string(31) "Tue, 01 Sep 2015 12:05:42 +0200"
Output for 5.4.42
string(31) "Tue, 22 Sep 2015 12:05:40 +0200" string(31) "Tue, 01 Sep 2015 12:05:40 +0200"
Output for 5.4.41
string(31) "Tue, 22 Sep 2015 12:05:37 +0200" string(31) "Tue, 01 Sep 2015 12:05:37 +0200"
Output for 5.4.40
string(31) "Tue, 22 Sep 2015 12:05:35 +0200" string(31) "Tue, 01 Sep 2015 12:05:35 +0200"
Output for 5.4.39
string(31) "Tue, 22 Sep 2015 12:05:33 +0200" string(31) "Tue, 01 Sep 2015 12:05:33 +0200"
Output for 5.4.38
string(31) "Fri, 06 Mar 2015 14:49:59 +0100" string(31) "Sun, 01 Mar 2015 14:49:59 +0100"
Output for 5.4.37
string(31) "Fri, 06 Mar 2015 14:49:53 +0100" string(31) "Sun, 01 Mar 2015 14:49:53 +0100"
Output for 5.4.34 - 5.4.36
string(31) "Fri, 06 Mar 2015 14:49:52 +0100" string(31) "Sun, 01 Mar 2015 14:49:52 +0100"
Output for 5.3.29, 5.4.32
string(31) "Fri, 29 Aug 2014 11:10:04 +0200" string(31) "Fri, 01 Aug 2014 11:10:04 +0200"
Output for 5.4.14 - 5.4.31
string(31) "Wed, 06 Aug 2014 13:04:09 +0200" string(31) "Fri, 01 Aug 2014 13:04:09 +0200"
Output for 5.3.23 - 5.3.28, 5.4.0 - 5.4.13
string(31) "Wed, 06 Aug 2014 13:04:10 +0200" string(31) "Fri, 01 Aug 2014 13:04:10 +0200"
Output for 5.3.3 - 5.3.22
string(31) "Wed, 06 Aug 2014 13:04:11 +0200" string(31) "Fri, 01 Aug 2014 13:04:11 +0200"
Output for 5.3.2
string(31) "Fri, 01 Aug 2014 13:04:11 +0200" string(31) "Fri, 01 Aug 2014 13:04:11 +0200"
Output for 5.3.0 - 5.3.1
string(31) "Fri, 01 Aug 2014 13:04:12 +0200" string(31) "Fri, 01 Aug 2014 13:04:12 +0200"
Output for 5.2.13 - 5.2.17
string(31) "Wed, 06 Aug 2014 13:04:12 +0200" Warning: DateTime::modify(): Failed to parse time string (first day of) at position 10 (o): The timezone could not be found in the database in /in/bm0q0 on line 10 string(31) "Tue, 05 Aug 2014 13:04:12 +0200"
Output for 5.2.0 - 5.2.12
string(31) "Wed, 06 Aug 2014 13:04:12 +0200" string(31) "Wed, 06 Aug 2014 13:04:12 +0200"
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/bm0q0 on line 3
Process exited with code 255.
Output for 4.4.2 - 4.4.9
Parse error: syntax error, unexpected T_VARIABLE in /in/bm0q0 on line 5
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1
Parse error: parse error, unexpected T_VARIABLE in /in/bm0q0 on line 5
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/bm0q0 on line 5
Process exited with code 255.