3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php echo (new DateTimeImmutable())->modify('first day of this month')->format('Y-m-d H:i:s');
based on UClpq
Output for 5.6.28, 7.0.20 - 7.2.0
2016-01-01 10:42:33
Output for 7.0.6
2016-05-01 13:57:02
Output for 7.0.5
2016-04-01 09:53:17
Output for 7.0.4
2016-03-01 22:00:50
Output for 7.0.3
2016-03-01 23:35:30
Output for 7.0.2
2016-03-01 05:43:08
Output for 7.0.1
2016-03-01 08:45:41
Output for 7.0.0
2016-03-01 10:38:34
Output for 5.6.21
2016-05-01 16:47:51
Output for 5.6.20
2016-04-01 08:55:42
Output for 5.6.19
2016-03-01 06:10:56
Output for 5.6.18
2016-03-01 15:09:35
Output for 5.6.17
2016-03-01 02:41:36
Output for 5.6.16
2016-03-01 11:28:25
Output for 5.6.15
2016-03-01 12:18:03
Output for 5.6.14
2016-04-01 18:00:26
Output for 5.6.13
2016-04-01 18:39:18
Output for 5.6.12
2016-04-01 09:09:52
Output for 5.6.11
2016-04-01 15:35:51
Output for 5.6.10
2016-04-01 17:41:34
Output for 5.6.9
2016-04-01 23:09:40
Output for 5.6.8
2016-04-01 07:36:06
Output for 5.5.35
2016-05-01 02:52:48
Output for 5.5.34
2016-04-01 11:10:34
Output for 5.5.33
2016-03-01 09:15:59
Output for 5.5.32
2016-03-01 19:08:18
Output for 5.5.31
2016-03-01 05:54:29
Output for 5.5.30
2016-04-01 14:09:23
Output for 5.5.29
2016-04-01 08:57:13
Output for 5.5.28
2016-04-01 12:29:27
Output for 5.5.27
2016-04-01 14:07:02
Output for 5.5.26
2016-04-01 20:23:01
Output for 5.5.25
2016-04-01 03:49:36
Output for 5.5.24
2016-05-01 10:21:17
Output for 5.4.12 - 5.4.45
Fatal error: Class 'DateTimeImmutable' not found in /in/Nq73a on line 3
Process exited with code 255.
Output for 5.3.22 - 5.3.29
Parse error: syntax error, unexpected T_OBJECT_OPERATOR, expecting ',' or ';' in /in/Nq73a on line 3
Process exited with code 255.