3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php echo 'Now: '; $now = new DateTime(); $now = $now->format('Y-m-d H:i:s'); echo $now; echo "\n"; echo 'One week ago: '; $oneWeekAgo = date('Y-m-d H:i:s', strtotime('-1 week')); echo $oneWeekAgo;
Output for 5.2.0 - 5.6.28, hhvm-3.10.0 - 3.12.0, 7.0.0 - 7.1.0
Now: 2014-03-07 12:35:03 One week ago: 2014-02-28 12:35:03
Output for 5.0.0 - 5.1.6
Now: Fatal error: Class 'DateTime' not found in /in/a5jNg on line 4
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Now: Fatal error: Cannot instantiate non-existent class: datetime in /in/a5jNg on line 4
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Now: Fatal error: Cannot instantiate non-existent class: datetime in /in/a5jNg on line 4