3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $now = new Datetime(); $pene = new DateTime($now); $pene = $pene->modify('-1 month'); $now = date_format($now, "m"); $pene = date_format($pene, "m"); echo $pene; echo $now;
based on n3W6N
Output for 7.0.0 - 7.1.0
Fatal error: Uncaught TypeError: DateTime::__construct() expects parameter 1 to be string, object given in /in/BrqZS:3 Stack trace: #0 /in/BrqZS(3): DateTime->__construct(Object(DateTime)) #1 {main} thrown in /in/BrqZS on line 3
Process exited with code 255.
Output for 5.2.1 - 5.6.28
Fatal error: Uncaught exception 'Exception' with message 'DateTime::__construct() expects parameter 1 to be string, object given' in /in/BrqZS:3 Stack trace: #0 /in/BrqZS(3): DateTime->__construct(Object(DateTime)) #1 {main} thrown in /in/BrqZS on line 3
Process exited with code 255.
Output for 5.2.0
Warning: DateTime::__construct() expects parameter 1 to be string, object given in /in/BrqZS on line 3 Warning: DateTime::modify(): The DateTime object has not been correctly initialized by its constructor in /in/BrqZS on line 4 Warning: date_format() expects parameter 1 to be DateTime, boolean given in /in/BrqZS on line 7 10
Output for 5.0.0 - 5.1.6
Fatal error: Class 'Datetime' not found in /in/BrqZS on line 2
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/BrqZS on line 2
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/BrqZS on line 2