3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $a = new DateTime('2015-05-04 17:22'); var_dump((string) $a->format('Y-m-d H:i:s')); $a->modify('+1 day'); var_dump((string) $a->format('Y-m-d H:i:s')); $a->modify('+1 weekday'); var_dump((string) $a->format('Y-m-d H:i:s')); var_dump(date('Y-m-d H:i:s', strtotime('+1 weekday')));
Output for 5.3.6 - 7.2.0
string(19) "2015-05-04 17:22:00" string(19) "2015-05-05 17:22:00" string(19) "2015-05-06 00:00:00" string(19) "2015-05-05 00:00:00"
Output for 5.3.0 - 5.3.5
string(19) "2015-05-04 17:22:00" string(19) "2015-05-05 17:22:00" string(19) "2015-05-06 17:22:00" string(19) "2015-05-05 00:00:00"
Output for 5.2.0 - 5.2.17
string(19) "2015-05-04 17:22:00" string(19) "2015-05-05 17:22:00" string(19) "2015-05-05 17:22:00" string(19) "2015-05-05 00:00:00"
Output for 5.0.0 - 5.1.6
Fatal error: Class 'DateTime' not found in /in/554H4 on line 3
Process exited with code 255.
Output for 4.3.2 - 4.4.9
Fatal error: Cannot instantiate non-existent class: datetime in /in/554H4 on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1
Fatal error: Cannot instantiate non-existent class: datetime in /in/554H4 on line 3